Link Search Menu Expand Document

Information schema for running queries

You can use the information_schema.running_queries view to return information about queries currently running in a database. The view is available in each database and contains one row for each running query in the database. You can use a SELECT query to return information about each running query as shown in the example below.

SELECT
  *
FROM
   information_schema.running_queries
LIMIT
  100;

Columns in information_schema.running_queries

Each row has the following columns with information about each running query.

Column Name Data type Description
engine_id TEXT The ID of the engine that was used to execute the query.
engine_name TEXT The name of the engine that was used to execute the query.
account_id TEXT The ID of the account in which the query was executed.
user_id TEXT The user ID that was used to execute the query.
start_time TIMESTAMP The query execution start time (UTC).
status TEXT The status of the query. Always contains the value ‘RUNNING’.
duration_usec BIGINT The elapsed time in microseconds between <START_TIME> and the time that the query over ` information_schema.running_queries` returns results.
query_id TEXT The unique identifier of the SQL query.
query_text TEXT Text of the SQL statement.
scanned_rows BIGINT The number of rows scanned to return query results.
scanned_bytes BIGINT The number of bytes scanned from cache and storage.
inserted_rows BIGINT The number of rows written.
inserted_bytes BIGINT The number of bytes written.