I try to run a query on genes 582479 using the OR operator after creating an index of properties: symbol, primaryidentifier, secondaryidentifier and name. This request:
PROFILE MATCH(g:Gene) WHERE g.symbol="CG11566" OR g.primaryidentifier="CG11566" OR g.secondaryidentifier="CG11566" OR g.name="CG11566" RETURN g.id, g.primaryidentifier, g.secondaryidentifier, g.symbol, g.name ORDER BY g.id;
Performance is very low, created indexes are not used, but only label scan → 2912399 total number of deleted elements in 3253 ms
Request to use UNION has been changed:
PROFILE MATCH(g:Gene) WHERE g.symbol='CG11566' return g.id UNION MATCH(g:Gene) WHERE g.primaryidentifier='CG11566' return g.id UNION MATCH(g:Gene) WHERE g.secondaryidentifier='CG11566' return g.id UNION MATCH(g:Gene) WHERE g.name='CG11566' return g.id;
Indexes Used
-> 8 total db deletes in 73 ms. Much better. Any better way to implement a query without using UNION?
source share