maxdemarzi / benchmarks

2 stars 1 forks source link

BusinessIntelligence-14 #21

Open davidfauth opened 4 years ago

davidfauth commented 4 years ago

Added index on :Post(creationDate)

maxdemarzi commented 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