Reputation: 309
I have this Cypher query and I can't figure out how to take advantage of a composite index when running it. I tried an index on type
, for
, buying
and renting
properties on both nodes, but the index doesn't show up on query's PROFILE
.
MATCH (prof:Profile)
MATCH (prop:Property)
WHERE prof.type = prop.type
and prof.for = prop.for
and prof.buying = prop.buying
and prof.renting = prop.renting
Is it even possible to achieve this?
Upvotes: 1
Views: 223
Reputation: 2656
This will do the trick (for the second node type) :
PROFILE MATCH (pp:Property)
WITH pp, pp.type as type, pp.for as for, pp.bying as buying, pp.renting as renting
MATCH (pf:Profile)
WHERE pf.type = type
AND pf.for = for
AND pf.buying = buying
AND pf.renting = renting
RETURN pp, pf;
The reason the index is not used is that it has no actual values to use it with, those are only available after the nodes have been scanned.
Hope this helps.
Regards, Tom
Upvotes: 1