You can use the information_schema.engine_query_history view to return information about queries saved to query history. The view is available in each database and contains two rows, the starting and ending row for each historical query in the database. The table includes the last ten thousand queries per engine cluster. You can run a SELECT query to retrieve details about recent queries, as shown in the following example:

SELECT
  *
FROM
  information_schema.engine_query_history
LIMIT
  100;

The information_schema.engine_query_history view retains only the most recent 10,000 queries. Queries exceeding this limit are excluded and will not appear in the query history. This limitation is important for high-volume workloads and tools like the OTEL exporter, which can rapidly fill the query history. To retain critical query data, regularly export or archive query history.

Columns in information_schema.engine_query_history

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

Column NameData TypeDescription
account_nameTEXTThe name of the account that ran the query.
user_nameTEXTThe user name that was used to run the query. The user_name is present for account-level operations, and NULL for organization-level operations.
login_nameTEXTThe login name that was used to run the query. The login_name is present for organization-level statements, and otherwise NULL.
service_account_nameTEXTThe service account name that was used to run the query. The service_account_name is present for organization-level statements, and otherwise NULL.
submitted_timeTIMESTAMPTZThe time that the user submitted the query.
start_timeTIMESTAMPTZThe time that the query started running in Coordinated Universal Time (UTC).
end_timeTIMESTAMPTZThe time that the query stopped running in UTC.
duration_usBIGINTThe duration of query run time in microseconds.
e2e_duration_usBIGINTThe end-to-end duration of query run time. Starting from the time the query was submitted and ending when the result was fully returned in microseconds.
statusTEXTCan be one of the following values:
STARTED_EXECUTION–Successful start of query execution.
ENDED_SUCCESSFULLY–Successful end of query execution.
CANCELED_EXECUTION–Query was canceled.
PARSE_ERROR–Query could not be parsed.
EXECUTION_ERROR–Query could not be executed successfully.
request_idTEXTThe ID of the request from which the query originates.
query_idTEXTThe unique identifier of the SQL query.
query_labelTEXTA user-provided query label.
query_textTEXTThe text of the SQL statement.
query_text_normalizedTEXTThe normalized text of the SQL statement.
query_text_normalized_hashTEXTThe hash of the normalized text of the SQL statement.
telemetryTEXTDisplays additional telemetry information about the query in JSON format. This data is currently only available for VACUUM queries and jobs.
error_messageTEXTThe returned error message.
scanned_rowsBIGINTThe total number of rows scanned.
scanned_bytesBIGINTThe total number of uncompressed bytes scanned.
scanned_cache_bytesBIGINTThe total number of compressed bytes scanned from disk-based cache.
scanned_storage_bytesBIGINTThe total number of compressed bytes scanned from Firebolt-managed storage. Does not apply to EXTERNAL tables.
inserted_rowsBIGINTThe total number of rows written.
inserted_bytesBIGINTThe total number of bytes written to both cache and storage.
spilled_bytesBIGINTThe total number of uncompressed bytes spilled.
returned_rowsBIGINTThe total number of rows returned from the query.
returned_bytesBIGINTThe total number of bytes returned from the query.
time_in_queue_usBIGINTThe number of microseconds the query spent in queue.
retriesBIGINTThe number of retried attempts in case of query failure. Defaults to 0.
node_ordinalINTEGERIndex of the node in the cluster that has received the query and manages the execution of it. (1-indexed)
cluster_ordinalINTEGERIndex of the cluster in the engine that has received the query and executes it. (1-indexed)
number_of_clustersINTEGERNumber of cluster in the engine at the point of query execution.