Slow query recommendations
Reference of recommendations that appear for assistance with resolving slow queries.
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 |
---|---|
Avoid ALLOW FILTERING | 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. |