Query history

The query history shows SQL queries performed using SQL warehouses. The query history holds query data for the past 30 days, after which it is automatically deleted.

You can use the information available through this screen to help you debug issues with queries.

This section describes how to work with query history using the UI. To work with query history using the API, see Query History API.

Important

The time recorded in query history for a SQL query is only the time the SQL warehouse spends actually executing the query. It does not record any additional overhead associated with getting ready to execute the query, such as internal queuing, or additional time related to the data upload and download process.

View query history

To view the history of all executions of a query:

  1. Click History Icon Query History in the sidebar.

  2. Optionally, click Duration to sort the list by duration. By default, the list is sorted by start time.

  3. Click the name of a query to see more details, such as the SQL command and the execution details.

If you’re a non-admin user without CAN_MANAGE permissions, you can only view your own queries in Query History.

Note

Queries shared by a user with Run as Owner permissions to another user with CAN RUN permissions appear in the query history of the user executing the query and not the user that shared the query.

View query details

To view details about a query, such as its duration, SQL command, number of rows returned, and I/O performance:

  1. View query history.

  2. Click the name of a query.

    Query history details

    Brief information about a query’s performance appears, such as time spent in each task, rows returned, and I/O performance.

  3. For more detailed information about the query’s performance,including its execution plan, click View Query Profile at the bottom of the page. For more details, see Query profile.

Terminate an executing query

To terminate a long-running query started by you or another user:

  1. View query history.

  2. Click the name of a query.

  3. Next to Status, click Cancel.

    Note

    Cancel only appears when a query is running.

The query is terminated and its status changes to Canceled.