Query history

The query history shows SQL queries performed using SQL warehouses.

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 2.0.

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.

You can filter the list by user, service principal, date range, SQL warehouse, and query status.

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

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.