Alexandru R
Alexandru R

Reputation: 8833

Why does Neo4j update of node properties take very long?

I have 10M nodes in a database. I'm using CYPHER to update nodes. When doing node return it takes about 1 second to return 10 (using LIMIT)

START e = node:events('shop:12345 AND attributes_vin:[* TO *]') 
WHERE HAS(e.attributes_vin) 
//SET e.attributes_vin = LOWER(e.attributes_vin)
RETURN e
LIMIT 10

When I add SET e.attributes_vin = LOWER(e.attributes_vin) for the same 10 nodes it takes 2 minutes.

What am I doing wrong? Thanks.

Upvotes: 0

Views: 192

Answers (1)

jjaderberg
jjaderberg

Reputation: 9952

I think the limit that you set only limits what is returned, not which nodes you set the property on (the property is set on all the matching nodes, and ten of them are returned).

Can you try breaking your query earlier with a WITH and set the limit there?

START e = node:events('shop:12345 AND attributes_vin:[* TO *]') 
WHERE HAS(e.attributes_vin)
WITH e LIMIT 10
SET e.attributes_vin = LOWER(e.attributes_vin)
RETURN e

Upvotes: 2

Related Questions