Performance tuning recipes

On this page Carat arrow pointing down
Warning:
Cockroach Labs will stop providing Assistance Support for v21.1 on November 18, 2022. Prior to that date, upgrade to a more recent version to continue receiving support. For more details, see the Release Support Policy.

This page provides recipes for fixing performance issues in your clusters.

Note:

If you aren't sure whether SQL query performance needs to be improved on your cluster, see Identify slow queries.

Problem Possible solution
Your application is experiencing high latency. Use the correct topology pattern for your cluster to minimize network latency.
  • Your application is experiencing degraded performance with the following serialization errors:
    • SQLSTATE: 40001
    • RETRY_WRITE_TOO_OLD
    • RETRY_SERIALIZABLE
  • The SQL Statement Contention dashboard in the DB Console is showing spikes over time.
  • The SQL Statement Errors graph in the DB Console is showing spikes in retries over time.
Your workload is experiencing contention
  • The statement plan produced by EXPLAIN or EXPLAIN ANALYZE indicates that the statement uses a full table scan.
  • Querying the crdb_internal.node_statement_statistics table indicates that you have full table scans in some statement's plans.
  • Viewing the statement plan on the Statement details page of the DB Console indicates that the plan contains full table scans.
  • Running the SHOW FULL TABLE SCANS statement returns results.
Poor quality statement plans retrieve more rows than are required, leading to longer execution times
  • The Hardware metrics dashboard in the DB Console shows high resource usage per node.
  • The Problem Ranges report on the Advanced Debug page of the DB Console indicates a high number of queries per second on a subset of ranges or nodes.
Your tables may be using a suboptimal primary key, causing resource contention

Yes No
On this page

Yes No