Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-17-2021 04:08 AM
I'm new to neo4j and tried making a query that gets the following:
My query looks like this:
Match (P:User {id: 5})
Match (a:Story)-[BEL_TO]->(P2: User)-[:FRI]-(P)
Where not (P)-[:SEEN]->(a) AND NOT a.priv = "bf"
optional Match (a)<-[:LIKE]-(P3: User)-[:FRI]-(P)
with a, COLLECT({id: P3.id, name: P3.name}) as flikes
optional Match (a)<-[:COM_ON]-(com:Com)-[:BEL_TO]->(P4: User)-[:FRI]-(P)
RETURN a.id as id, flikes, COLLECT({id: P4.id, name: P4.name, comment: com}) as fcomments
LIMIT 35
When I run this query, I get the results I want, but I tested the query in the following scenario:
The query takes around 1500 ms
Is there a way to make this query more efficient/faster ?
Things I thought of:
Thanks in advance.
Screenshot of profiler:
04-17-2021 01:23 PM
You can run the "create index" only once before your Cypher.
CREATE INDEX index_priv FOR (a:Story) ON (a.priv);
All the sessions of the conference are now available online