Using the History Page to Monitor Queries¶
The History page allows you to view and drill into the details of all queries executed in the last 14 days. The page displays a historical listing of queries, including queries executed from SnowSQL or other SQL clients. The default information displayed for each query includes:
- Current status of queries: waiting in queue, running, succeeded, failed.
- SQL text of your query.
- Query ID.
- Information about the warehouse used to execute the query.
- Query start and end time, as well as duration.
- Information about the query, including number of bytes scanned and number of rows returned.
In this Topic:
Overview of Features¶
You can perform the following tasks in the History page:
- Use the auto-refresh checkbox in the upper right to enable/disable auto-refresh for the session. If selected, the page is refreshed every 10 seconds. You can also click the Refresh icon to refresh the display at any time.
- Use the Show/Hide Filters toggle to open/close a panel where you can specify one or more filters that control the queries displayed on the page. Filters you specify are active for the current session.
- Scroll through the list of displayed queries. The list includes (up to) 100 of the first queries that match your filters, or the latest 100 queries (when no filters are applied). At the bottom of the list, if more queries are available, you can continue searching, which adds (up to) 100 of the next matching queries to the list.
- Click any column header to sort the page by the column or add/remove columns in the display.
- Click the text of a query (or select the query and click View SQL) to view the full SQL for the query.
- Select a query that has not yet completed and click Abort to abort the query.
- Click the ID for a query to view the details for the query, including the result of the query and the Query Profile.
The History page displays queries executed in the last 14 days, starting with the most recent ones. You can use the End Time filter to display queries based on a specified date; however, if you specify a date earlier than the last 14 days, no results are returned.
Viewing Query Details and Results¶
Snowflake persists the result of a query for a period of time (currently 24 hours), after which the result is purged. This limit is not adjustable.
To view the details and result for a particular query, click the Query ID in the History page. The Query Detail page appears (see below), where you can view query execution details, as well as the query result (if still available).
You can also use the Export Result button to export the result of the query (if still available) to a file.
You can view results only for queries you have executed. If you have privileges to view queries executed by another user, the Query Detail page displays the details for the query, but, for data privacy reasons, the page does not display the actual query result.
Exporting Query Results¶
On any page in the interface where you can view the result of a query (e.g. Worksheets, Query Detail), if the query result is still available, you can export the result to a file.
When you click the Export Result button for a query, you are prompted to specify the file name and format. Snowflake supports the following file formats for query export:
- Comma-separated values (CSV)
- Tab-separated values (TSV)
- You can export results only for queries for which you can view the results (i.e. queries you’ve executed). If you didn’t execute a query or the query result is no longer available, the Export Result button is not displayed for the query.
- The web interface only supports exporting results up to 100MB in size. If a query result exceeds this limit, you are prompted whether to proceed with the export.
- The export prompts may differ depending on your browser. For example, in Safari, you are prompted only for an export format (CSV or TSV). After the export completes, you are prompted to download the exported result to a new window, in which you can use the Save Page As… browser option to save the result to a file.