Search code examples
cassandradatastax-enterprisedatastax-java-drivercassandra-3.0cqlsh

Cassandra coordinator read timeout count operation vs select all


I have 4 node dse 5.1.2 Cassandra cluster on avg each node has 3 gb data.i am trying to query on that data. I know i should not do the below queries as it has bad effects in cassandra. But what i observed is

select * works , but select count(*) fails

on the same table with coordinator timeout.when both perform same operation in back ground while reading , why is the difference. my cluster is 100% repaired and no tombstones found in that table. i also increased read request timeout in cqlsh command.

I am getting the below error for query

select count(*) from xxx.xxxx;

ReadTimeout: Error from server: code=1200 [Coordinator node timed out waiting for replica nodes' responses] message="Operation timed out - received only 0 responses." info={'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}

Solution

  • If you are running those commands via cqlsh then they are not strictly the same.

    cqlsh has a default limit of 10000 lines so unless you have changed that limit that is all you are going to get with your select *.

    The select count(*) is going to do a full table scan on all nodes to get the count, hence the timeout.