Updated on 2024-11-20 GMT+08:00

Queries

Using a Sort Key for Range Query

It is recommended that the sequence of the sort keys for range query be the same as that used during table creation. Otherwise, the performance deteriorates.

If no sort key sequence is specified, the default sort key sequence is ASC during query and table creation.

Not Using ALLOW FILTERING

If a query statement does not specify all primary keys and contains ALLOW FILTERING, the query will scan and filter the entire table. A table with a large data volume may cause the query to time out. ALLOW FILTERING is forbidden in later kernel versions.

Query timeout and excessive resource usage issues that occur when ALLOW FILTERING is used are not within commitments on SLAs

COUNT Query

If a database contains a very large amount of data, do not run the following statement to query the database. Otherwise, the query may fail.

select count(*) from "test" where sds_uid='100000000000000006250004';

The following statement is recommended:

select sum(row_count) From system_distributed.size_estimates WHERE keyspace_name='' and table_name='';

This query is an asynchronous task in the background, so the results are not accurate and for reference only.