cassandracql

select count(*) runs into timeout issues in Cassandra


Maybe it is a stupid question, but I'm not able to determine the size of a table in Cassandra.

This is what I tried:

select count(*) from articles;

It works fine if the table is small but once it fills up, I always run into timeout issues:

cqlsh:

DBeaver:

I assume that it hits some timeout and just aborts. The actual number of entries in the table is probably much higher.

I'm testing against a local Cassandra instance which is completely idle. I would not mind if it has to do a full table scan and is unresponsive during that time.

Is there a way to reliably count the number of entries in a Cassandra table?

I'm using Cassandra 2.1.13.


Solution

  • As far as I see you problem connected to timeout of cqlsh: OperationTimedOut: errors={}, last_host=127.0.0.1

    you can simple increase it with options:

     --connect-timeout=CONNECT_TIMEOUT
                           Specify the connection timeout in seconds (default: 5
                           seconds).
     --request-timeout=REQUEST_TIMEOUT
                           Specify the default request timeout in seconds
                           (default: 10 seconds).