Thursday, October 26, 2017

Counting Nodes With Multiple Labels

DZone Database Zone
Counting Nodes With Multiple Labels
Counting Nodes With Multiple Labels

We have over 6,000 users in our #neo4j-users slack channel and get all kinds of requests. About a month ago Thomas Shields asked:

Should counting the set of things with 2 labels really take so long? I've got 48M nodes with LabelA and LabelB and the query MATCH (n:LabelA:LabelB) RETURN COUNT(n) is taking 80-90 seconds.

Let's see what's going on by creating a small version of his graph. We will create 1M nodes of LabelA, then 1M nodes with both LabelA and LabelB, and then 1M nodes with just Label B:

No comments:

Fun With SQL: Functions in Postgres

DZone Database Zone Fun With SQL: Functions in Postgres In our previous  Fun with SQL  post on the  Citus Data  blog, we covered w...