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.

Cartesia product

hi, i have a problem with this quary:
match(n:Reato), (m:Reato) where n.Id > m.Id with toInteger(apoc.text.jaroWinklerDistance(n.totale, m.totale) * 100) as sim1,toInteger(apoc.text.distance(n.totale, m.totale) * 100) as sim2 where sim1 > 85 create (n)-[f:SIMILE{sim1:sim1, sim2:sim2, dist:abs(sim1-sim2), media:(sim1 + sim2)/2}]->(m)

totale is a text

In my database there are 1260 "Reato", so when i start the quary my pc can't process all these data.
How can i divide the quary in 3 or 4 parts in order to lighten the work of my pc (macBook air)?

1 REPLY 1

Hi @lorenzo.braglia99 !
I think the main problem is the WHERE condition, there's lots of comparisons to be made, in fact you are probably gathering and inspecting the whole database 1260 times. I would recommend to run an explain first to see what the execution plan is doing. Also, I have a few questions to understand the problem:

  1. Have you tried using indexes on id? Indexes could fasten the comparisons.

  2. Do you have the default values on memory heap size? You could try to tweak this values to your need.

  3. Could you explain a bit more of your use case? Maybe there's another way to approach the problem.

Hope this helps. Cheers!