Snowflake - Query & Results History
Guidance Questions
- Where (in the WebUI) do I go to view recent query results and query profile information?
- SnowSight:
- Query history is available in the Query History page in Snowsight.
- In the Query History page, you can:
- Monitor queries executed by users in your account.
- View details about series, including performance data.
- Explore each step of an executed query in the query profile.
- Only includes queries executed in the past 14 days.
- Some queries are not available in the Query History page, this can be due to:
- The query is still running, when it finishes it will appear in the Query History.
- Your roles does not have permission to view it.
- The query is more than 14 days old.
- The query failed to run.
- Source
- Source
- Classic Interface:
- The 'History' tab, here you can see the queries executed in the past 14 days.
- The following information included about each query includes:
- Current status of queries: waiting, running, succeeded or failed.
- The SQL text of the query.
- The QUERY ID.
- The Warehouse that executed the query.
- The start and end time as well as duration.
- The size of the transaction in bytes.
- The number of rows affected.
- Source
- Is based on the
QUERY_HISTORY
view, which:
- Contains the query history of the past 365 days.
- Is available only in the reader account view of
READER_ACCOUNT_NAME
.
- Source
- How far in the past am I able to view query profiles and results using the WebUI?
- 14 days of query history in both Classic Interface and SnowSight.
- Queries older than 7 days don't show the user that executed the query in Snowsight.
- Older queries can be queried but will return no results.
- To view older queries the
QUERY_HISTORY
view can be used to view queries up to 365 days old.
- Source-WebUI
- Source-SnowSight
- Can I view my co-workers queries?
- Yes, but only the results.
- In Classic Console you can only view the queries your user has executed, although you can view the queries executed by other users if you have the privileges to do so, but for privacy reasons the results will not be shown.
- Source
- Can I view the queries run by my company's ETL tool that connects using JDBC?
- Yes, if you have the correct privileges.
- Can I download query results from this morning without having to run the query again?
- Yes, the results can be downloaded in the form of a CSV or other similar formats. Source
- The results persist for 24h(not adjustable). Source
- Can I download the results of my coworker's query from this morning?
- No, you cannon view other peoples results.
- Source
- I need to quickly look at this week's queries but only for a particular warehouse, and I want to visually compare queuing time for each query, can I do this from the WebUI?
- You can filter queries for the following attributes:
- Status of Query (waiting, running, successful, failed)
- User, only users you have permissions to view will appear.
- Time period in which the query was executed.
- SQL Text, for example queries that used statements like
GROUP BY
.
- Query ID, if you need to view a specific query.
- Warehouse, to view queries executed by specific warehouse.
- Statement Type, to view queries that used specific statements like
DELETE
, UPDATE
, INSERT
or SELECT
.
- Duration, for example to look for long running queries.
- Session ID, to filter based on specific Snowflake Session.
- Query Tag, to view queries with a specific QUERY TAG session parameter.
- Source
Quiz:
- What two types of caches were mentioned in the video?
- Metadata Cache - the cache holding metadata about the database like size, number of rows, etc.
- Results Cache - which holds results of previous queries up for 24h.
- Using the History area of the WebUI, how far back in time is query history available?
- 14 days.
- The columns in the query history include the QueryID, the SQL Text, the Warehouse name, the Warehouse Size, the Session ID and others. Which column is a good indicator of whether a Warehouse was used (and Compute costs incurred) by a query?
- Size.
- FDNIEGE is running queries using SYSADMIN and ACCOUNTADMIN roles. User ALICE is using the PUBLIC Role.
- FDNEIGE can see all of ALICES queries, since she has higher privileges.
- ALICE cannon see any other user's queries because PUBLIC is the lowest role.
- FDNEIGE can see all other user's queries when her role is et to ACCOUNTADMIN.
-
- FDNEIGE cannot see ALICE's results, because users cannot see other users results.
- A query you initiated is taking too long. You've gone into the History area to check whether this query (which usually runs every hour) is supposed to take a long time.
- Information in the History area can be filtered to show a single Warehouse.
- Information in the History area can be filtered to show a single User.
- Information in the History area can be filtered to show a single Session.
- Information in the History area can be filtered to show a single query times.
- A hour ago, you ran a complex query. You then ran several simple queries from the same worksheet. You want to export the results from the complex query but they are no longer loaded in the Results pane of the worksheet. What is the least costly way to download the results?
- Click on History -> Locate the query -> Click the QueryID -> Use the "Export Result" button.
- You have a dashboard that connects to Snowflake via JDBC. The dashboard is refreshed hundreds of time per day. The data is very stable, only changing once or twice per day. The query ran by the dashboard connector user never changes. How will Snowflake manage changing and non-changing data?
- Snowflake will show the most up-to-date data each time the dashboard is refreshed.
- Snowflake will spin up a warehouse only if the underlying data has changed.
- Snowflake will re-use data from the Result Cache as long as it is still the most up-to-date data available.
- When running a SELECT COUNT(*) on a table, which of the following statements is true?
- No Warehouse will be needed because Count statistics are stored in the Metadata cache.