0

These are the queries I use to load from .csv file:

USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM "file:///products.csv" AS row CREATE (:Product {id: row.idProduct, name: row.name, description: row.description, price: row.price, shipping_price: row.shippingPrice});

In this consultation I take days to create relationships:

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///products.csv" AS row
MATCH (Product:Product {id: row.idProduct})
MATCH (category:Category {id: row.idProductCategory})
MERGE (category)-[:OF_CATEGORY]->(Product);

Is there any way to create, or import relationships for millions of nodes?

iamdanchiv
  • 4,052
  • 4
  • 37
  • 42
Claure
  • 55
  • 1
  • 1
  • 4
  • 1
    Do you have indexes or unique constraints on :Product(id) and :Category(id)? You'll need those to improve your lookup speed for your start and end nodes. – InverseFalcon Jul 07 '17 at 11:06
  • Ok add indexes: Product (id) and: Category (id) and see what results I get thanks for the help. – Claure Jul 07 '17 at 19:57
  • I am also adding relationships with this query – Claure Jul 07 '17 at 19:59
  • MATCH (prodcategory:Category {ididRestaurant: prodcategory.idRestaurant}) MATCH (resto:Subscriber {id: resto.id}) WHERE prodcategory.idRestaurant=resto.id MERGE (prodcategory)-[:DEFINED_BY]->(resto); – Claure Jul 07 '17 at 19:59

0 Answers0