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.

Best practise for query which return big collection of data

aerfan
Node Link

I have a cypher query which return collection of data depending on other relationships but the query takes long time compared with other queries 
Here is my query 

MATCH (current_p:Photographer) WHERE current_p.nodeId = 791
MATCH (t:Tag)<-[r:INTERESTS_IN]-(other_p:Photographer)-[:UPLOADS]->(i:Photo)
WHERE t.nodeId IN [994,992,990,993,988,991,989,256,54,10370,810,61,517,279,423,13240,13244,13241,13239,13245]
AND other_p.nodeId <> 791 AND i.deleted_at is null
OPTIONAL MATCH (current_p)-[r_follow:FOLLOWS]->(other_p)
WITH DISTINCT other_p, r, i, r_follow
ORDER BY r.last_hitting_time DESC, r.weight DESC, other_p.nodeId
RETURN DISTINCT other_p, COLLECT(DISTINCT(i))[..4] as photos, r_follow
SKIP 0 LIMIT 3
And the array of Ids is have different ids for each user
If any problem in the query pls tell me how to enhance it
1 REPLY 1

TrevorS
Community Team
Community Team

Hello @aerfan 

Were you able to resolve this issue? If you were able to do so, can you please post your solution?

If you are still needing assistance, I would recommend you create a ticket here.

Thanks,

TrevorS
Community Specialist