Skip to main content
The SHOW FULL TABLE SCANS lists recent queries for which CockroachDB performed a full table scan during query execution. Limiting the number of queries that require full table scans can help you optimize query execution performance. For more information on query performance optimization, see and .

Syntax

show_full_scans syntax diagram SQL syntax diagram

Required privileges

The is required to run SHOW FULL TABLE SCANS.

Examples

To follow along, run to start a temporary, in-memory cluster with the sample preloaded:
Now, suppose that you want to query the rides table for all rides that cost above 90 (i.e., WHERE revenue > 90):
This SELECT statement requires a full table scan at execution. As a result, the query will show up in the SHOW FULL TABLE SCANS output, with all of the other queries that performed full table scans:
To limit the number of rows scanned by SELECT queries that filter on the revenue column, you can add a secondary index to the rides table, on the revenue column:
Now, if you execute a similar query, the query will not perform a full table scan.

See also