Returning count much faster than the nodes

I realise this may be a newbie 101 question so please bear with me.

I've noticed that my slowest queries, which take minutes to return 2K + nodes take a few seconds if I'm only counting the results. Is this due to the memory overhead of loading the nodes into RAM? I assumed the times would be similar - that the time would be spent in the plan execution - not in returning the results? I'd be grateful to know what's the general cause for this difference.

Btw, I've been reading the pinned articles in the meantime on tuning (many thanks).

Thanks in advance

Depending on the type of query the "count store" might hook in. Count store "knows" how many nodes by label you have and couple of more information.
Another reason is that returning nodes utilizes more network bandwidth than just returning a number.
Neo4j browser rendering sometimes gives you a misleading impression regarding query speed, for testing speed cypher-shell is the better tool.

Thanks for the tips, Stefan. I've started using the shell now - I can see what you mean by the speed.

1 Like