Slow query recommendations

Recommendations that appear for assistance with resolving slow query issues are described in the table. The recommendations appear in the Recommendations panel when the Performance Service detects known issues in a CQL query statement.

Recommendation Description


Checks that ALLOW FILTERING is not used in queries. Please consider a new data model based on the query pattern instead of using ALLOW FILTERING.

Avoid using large batches

Using large batches seems like an optimization but doing so puts extra load on the coordinator, which can cause cluster hotspots in the cluster. Queries run faster after breaking large batches into individual queries and distributing them to different nodes.

Minimize keys used within the IN clause

Huge IN clauses can give the impression of a singular query but the clauses actually execute as multiple queries. Make individual async queries distributed amongst more coordinators.

Use counter instead of count

A count(*) query can be expensive, even with smaller limits. Replace the logic with a counter you maintain.

Use prepared statements for your queries

Prepared statements reduce the workload on the coordinator by removing the overhead of parsing the query.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000,