YCQL Count Number of Records in Table

Hi,
I have a tables that is in upwards of billions of records in YCQL. Is there a way to get the count of number of records in the table.

if I do select count(*) from tableXYZ, it will timeout and not able to return.

Regards,
Tommy

You can use partition_hash feature to make distributed counts or table scans like explained in the docs Built-in function call [YCQL] | YugabyteDB Docs

For row-count specifically, refer to “ycrc” documented here:

Underneath the covers, it uses the partition_hash() capability (that @dorian_yugabyte is referring to) in order to break down the query into smaller parts and run those tasks in parallel.