infra: neo4j generator creates indexes for fast relationship MERGE
This commit is contained in:
@@ -88,6 +88,9 @@ def main():
|
|||||||
auth=(DB_USER, DB_PASSWORD))
|
auth=(DB_USER, DB_PASSWORD))
|
||||||
|
|
||||||
with driver.session() as session:
|
with driver.session() as session:
|
||||||
|
# Indexes make relationship MATCH/MERGE fast even with many existing nodes
|
||||||
|
session.run("CREATE INDEX product_id_idx IF NOT EXISTS FOR (p:Product) ON (p.product_id)")
|
||||||
|
session.run("CREATE INDEX supplier_id_idx IF NOT EXISTS FOR (s:Supplier) ON (s.supplier_id)")
|
||||||
print(f"Generating {TARGET_NODES} product nodes...")
|
print(f"Generating {TARGET_NODES} product nodes...")
|
||||||
print(f"Batch size: {BATCH_SIZE}")
|
print(f"Batch size: {BATCH_SIZE}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user