SHOW STATEMENTS lists details about currently active SQL queries, including:
- The internal ID of the query
- The node executing the query
- The SQL query itself
- How long the query has been running
- The client address, application name, and user that issued the query
- The ID for the current session
Schema changes and / statements are not executed as queries internally and so are not listed by
SHOW STATEMENTS. To monitor such statements, use instead.Aliases
In CockroachDB, the following are aliases forSHOW STATEMENTS:
SHOW QUERIES
Required privileges
All users can see their own currently active queries. Users with the can view see all users’ currently active queries.VIEWACTIVITYREDACTED causes constants in queries being executed by other users to be redacted.
Synopsis
- To list the active queries across all nodes of the cluster, use
SHOW STATEMENTSorSHOW CLUSTER STATEMENTS. - To list the active queries just on the local node, use
SHOW LOCAL STATEMENTS.
Response
The following fields are returned for each query:Examples
List queries across the cluster
SHOW STATEMENTS to receive the same response.
List queries on the local node
Filter for specific queries
You can use a statement to filter the list of active queries by one or more of the response fields.Show all queries on node 2
Show all queries from a specific address and user
Exclude queries from the built-in SQL client
To exclude queries from the , filter for queries that do not show$ cockroach sql as the application_name:
Cancel a query
When you see a query that is taking too long to complete, you can use the statement to end it. For example, let’s say you useSHOW CLUSTER STATEMENTS to find queries that have been running for more than 3 hours:
query_id and use it with the CANCEL QUERY statement:

