Hi folks
I have database with about 7m nodes and relationships, and I'm currently executing the following query:
CALL db.index.fulltext.queryNodes('organization', 'food' )
YIELD node
WITH node as org LIMIT 5000
MATCH (org)<-[:LOCATED_IN]-(loc:Location)
WHERE loc.zipCode="75219" OR loc.zipCode="75001" OR loc.zipCode="75002" OR loc.zipCode="75006" OR loc.zipCode="75007" OR loc.zipCode="75009" OR loc.zipCode="75010" OR loc.zipCode="75011" OR loc.zipCode="75013" OR loc.zipCode="75014" OR loc.zipCode="75015" OR loc.zipCode="75016" OR
RETURN DISTINCT org, loc
SKIP 0 LIMIT 5
The query above simply does a full-text search with the word food
and retrieves all related location nodes where the zipcode is any of the above.
This works fine, but it's relatively slow, and I would appreciate any help to make it faster.
Using the PROFILE tool, I can see that the bottleneck is in two places, the MATCH
and WHERE
clauses.
So my question is, is there an optimal way of doing this to make it faster?. The current speed is approximately 30-40 seconds.