OWASP / OWASP/OpenCRE

Add Indexing Suggestions or Documentation for Slow Neo4j Queries

Open
#622 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
180
Forks
137
Avg merge
3d 23h
Merged PRs (30d)
21

Description

Problem

While working on the AI mapping pipeline, I noticed that some Neo4j queries (especially involving relationships like (:Standard)-[:MAPPED_TO]->(:CRE)) become significantly slower on larger datasets.

Currently, the repository does not document:

  • Which properties should be indexed in the Neo4j database.
  • Any query patterns that should be avoided for performance reasons.
  • Indexing strategies used in production (if any).

This can lead to performance bottlenecks, especially when using CALL db.indexes() shows minimal or no usage of compound indexes.


Proposal

We can:

  • Add a basic docs/neo4j-indexing.md file listing:

    • Recommended indexes (e.g., on Standard.external_id, CRE.id, CRE.name)
    • Optional compound indexes for common query paths
    • Tips on avoiding slow patterns (e.g., avoid expanding entire graph via MATCH (n)-[*]->(m))
  • Log and benchmark existing slow queries using PROFILE/EXPLAIN and annotate them in the AI mapping script as comments or docstrings.


Benefits
  • Helps contributors understand how to structure performant queries.
  • Ensures production setups follow best indexing practices.
  • Makes AI mapping and CRE-Standard linking significantly faster.

Optional: Related Queries

For example:

MATCH (s:Standard)-[:MAPPED_TO]->(c:CRE) WHERE s.external_id = $id RETURN c

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed docs/neo4j-indexing.md file and inspect the AI mapping queries that use Standard, CRE, and MAPPED_TO. Use PROFILE or EXPLAIN on the related query patterns to identify what can be documented. Done means the recommended indexes, compound-index guidance, and slow query patterns are recorded with enough context for contributors to apply them.

Written by the indexing model from the issue text.

Assessment

Tech stack
neo4j
Domain
databases, documentation, performance
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.