cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Query very slow

I have a file with more than 69141 transaction, per each transactions I need to update the relation PAGA setting paid to true.
I use the following query :
:auto USING PERIODIC COMMIT
load CSV WITH HEADERS FROM 'file:///PaidTransactions.csv' as row
FIELDTERMINATOR ';'
WITH row
WHERE row.invoice_id IS NOT NULL
match (()-[r:PAGA {idFattura:row.invoice_id}]->()) set r.paid=true;
 
The process is very slow, any suggestion how I can improve the query 
Thank you 
Rinaldo 
4 REPLIES 4

Hi @rinaldo_bonazzo !

What Neo4J version are you using? looks like you may need an index on your relationship, something that's possible from version 4.3.

Bennu

Oh, y’all wanted a twist, ey?

Hi @bennu_neo thanks for your answer, we're using 4.4.5 and an index is present for idFattura

Create an relationship index on :PAGA(idFattura)

 

https://neo4j.com/docs/cypher-manual/current/indexes-for-search-performance/#administration-indexes-...

If that index is used then you should see it in EXPLAIN of your query

Question would also why is the invoice a relationship and not a node?

Also what's the memory config of your database? Could be that you have too little memory (or a too slow disk) to write the transaction quickly.

 

Hi @michael_hunger  thank you

index is present, invoice is relation while I'm managing the flow from companies. If I use a node I need a relation from seller to invoice and one from invoice to seller.

My laptop is a mac M1 64GB, need to check the memory config to neo4j.