Neo4j Performance Issue while creating relationship on existing nodes? -


indexes products:

  1. on: products(saleid)
  2. on: products(countryid)
  3. on: products(productid)
  4. on: products(id)
  5. few more properties...

indexes orders:

  1. on: orders(saleid)
  2. on: orders(countryid)
  3. on: orders(productid)
  4. on: orders(id)
  5. few more properties...

product has 50k nodes

orders has 500k nodes

when create relation on above scenarios on existing nodes. takes 15 mins in community version 3.1.

query:

match(prod:products)  prod.id = 999  prod  match (ord:orders)  ord.id = prod.id , ord.saleid=prod.saleid , ord.countryid  = prod.countryid , ord.productid = prod.productid  create (prod)-[prod_ord]->(ord) 

current conig:

ram - 64g heap max = min = 32 page swap = default/auto

db hit -> 500 million hits

enter image description here

q1. not considering indexes, how force considering indexing via following indexes?

using index on prod:product(saleid)

using index on prod:product(productid)

using index on prod:product(countryid)

using index on prod:product(id)

q2. why take time? configuration needs done? or data model wrong?

your query uses products label, index on product.

also extract product id parameter , use in second match. should use orders(id) index:

match (prod:products)  prod.id = {prodid}  prod  match (ord:orders)  ord.id = {prodid} , ord.saleid=prod.saleid , ord.countryid  = prod.countryid , ord.productid = prod.productid  create (prod)-[prod_ord]->(ord) 

you can set parameter in browser

:param prodid : 999 

the other indexes not useful, because doing lookup on 1 property , filter results faster using multiple lookups , doing kind of join. if of properties more unique use instead.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -