Complete the code to view the query profile for a specific query in Snowflake.
SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY()) WHERE QUERY_ID = '[1]';
You need to replace the blank with the actual query ID as a string to filter the query history.
Complete the code to retrieve the query plan for a given query ID in Snowflake.
SELECT * FROM TABLE(INFORMATION_SCHEMA.GET_QUERY_OPERATOR_STATS('[1]'));
The query ID must be provided as a string to the GET_QUERY_OPERATOR_STATS table function to get the query plan.
Fix the error in the code to correctly get the query profile for the last executed query.
SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY()) WHERE QUERY_ID = [1];LAST_QUERY_ID() is a function that returns the last query ID without quotes.
Fill both blanks to create a query that shows the query history filtered by user and ordered by start time descending.
SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY()) WHERE USER_NAME = '[1]' ORDER BY [2] DESC;
Replace {{BLANK_1}} with the user name string and {{BLANK_2}} with the column START_TIME to order by start time.
Fill all three blanks to create a query that retrieves query history for a specific warehouse, filters by execution status, and orders by total elapsed time descending.
SELECT QUERY_ID, EXECUTION_STATUS, TOTAL_ELAPSED_TIME FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY()) WHERE WAREHOUSE_NAME = '[1]' AND EXECUTION_STATUS = '[2]' ORDER BY [3] DESC;
Fill the warehouse name string, filter for successful executions, and order by total elapsed time descending.