Skip to main content
The SHOW STATISTICS lists used by the . By default, CockroachDB on all indexed columns and up to 100 non-indexed columns, and automatically collects on the columns that prefix each index.

Synopsis

show_stats syntax diagram

Required Privileges

To list table statistics, the user must have any on the table being inspected.

Parameters

Options

Output

Examples

Setup

To follow along, run to start a temporary, in-memory cluster with the sample dataset preloaded:

List table statistics

Display forecasted statistics

The WITH FORECAST option calculates and displays along with the existing table statistics. The following example shows 3 historical statistics collections and the subsequent forecast:

Delete statistics

To delete statistics for all tables in all databases:
To delete a named set of statistics (e.g, one named “users_stats”), run a query like the following:
For more information about the DELETE statement, see .

See also