Open davidfauth opened 4 years ago
Without an index this is better as well.
MATCH (post:Post)
WHERE $endDate >= post.creationDate >= $startDate
WITH post
MATCH (post)<-[:REPLY_OF*0..]-(reply)
WHERE $endDate >= reply.creationDate >= $startDate
WITH post, reply
MATCH (person)<-[:HAS_CREATOR]-(post)
RETURN
person.id,
person.firstName,
person.lastName,
count(DISTINCT post) AS threadCount,
count(DISTINCT reply) AS messageCount
ORDER BY
messageCount DESC,
person.id ASC
LIMIT 100
Added index on :Post(creationDate)