Search code examples
cassandracassandra-2.0gocql

Paging Large Queries: total number


Regarding Cassandra and paging. I might guess the answer but just to be sure;

I know how to ask for a pagesize, but is it possible to get the eventually total number for a query. Like you query select * from tableName with a pagesize of 10, but if you did not use paging you would get 100. Is it possible to get the number 100 when using pagesize 10?

Note: Just if it is of any use, I am using gocql.


Solution

  • Plain answer is no, getting number 100 in your example means knowing the result of "SELECT count(*) FROM table", which is a perf killer query.

    The best thing you can get is an estimate of number of partitions per node using nodetool or calling directly JMX Beans. But it won't get you the estimate of CQL row (because in 1 partition there may be N rows if your table has clustering columns)