3

I know there are many questions about this already, but I have another angle on this.

First of all what I've confirmed is that in Cassandra < 2.2 the COUNT(*) LIMIT N works as one would expect - it returns N if there are more results.

In the later versions, however, this behavior was changed - now the LIMIT has practically no effect as it refers to the number of rows which is always 1 when using COUNT.

Furthermore, here are the Datastax docs on the SELECT for 2.1.

Here they correctly describe the COUNT behavior.

And here are the docs for 3.0 version: where they simply omit the use-with COUNT-LIMIT.

Here is the post about counting, where they never mention the version:

What I am concerned is the performance of this aggregation: Does it mean that in > 2.2 it gets much slower than before as it now has to go through all the rows matching the criteria?

Nestor Sokil
  • 2,162
  • 12
  • 28
  • Possible duplicate of [Cassandra CQL Select count with LIMIT](https://stackoverflow.com/questions/36174805/cassandra-cql-select-count-with-limit) – Horia Mar 27 '18 at 20:41

0 Answers0