0
votes

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'}
1
Is the intention to do get the count programmatically or one time thing? - dilsingi
i have spark code to get the count.But still didn't understand why this happened in cqlsh . - user7982987
Cassandra or any distributed system for that matter isn't designed for running queries that requires every row in every partition to respond. So count(*) working might be a hit and a miss. If you need a approximation on count, cassandra exposes it with "nodetool cfstats" command or via JMX counter EstimatedColumnCountHistogram - dilsingi

1 Answers

0
votes

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.