-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Context
Following the Memgraph connector improvements in PR #131, we identified that upsert_docs_batch performance degrades significantly without indexes on match_keys.
The MERGE operation without an index on the match keys results in O(n) scans per document, leading to O(n²) overall complexity for batch inserts.
Proposed Solution
Add automatic index creation on match_keys in upsert_docs_batch for FalkorDB, similar to what was implemented for Memgraph:
# Auto-create index on match_keys for MERGE performance (idempotent)
for key in match_keys:
try:
self.execute(f"CREATE INDEX FOR (n:{class_name}) ON (n.{key})")
except Exception:
pass # Index already existsExpected Impact
Based on Memgraph results:
- Before: ~1000 docs/sec for large batches
- After: ~72,000 docs/sec (70x improvement)
Notes
- FalkorDB uses slightly different Cypher syntax:
CREATE INDEX FOR (n:Label) ON (n.property) - Index creation is idempotent (errors on existing index are silently ignored)
Metadata
Metadata
Assignees
Labels
No labels