0
0
Snowflakecloud~20 mins

Query history and profiling in Snowflake - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Query History and Profiling Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Understanding Query History Table Output
You run the following query in Snowflake to check recent query history:

SELECT query_id, user_name, execution_status, total_elapsed_time FROM table(information_schema.query_history()) WHERE user_name = 'ANALYST' ORDER BY start_time DESC LIMIT 3;

What will the total_elapsed_time column represent in the output?
Snowflake
SELECT query_id, user_name, execution_status, total_elapsed_time FROM table(information_schema.query_history()) WHERE user_name = 'ANALYST' ORDER BY start_time DESC LIMIT 3;
AThe time in microseconds spent transferring data to the client.
BThe time in seconds the query spent waiting in the queue before execution.
CThe CPU time consumed by the query during execution.
DThe total time in milliseconds that the query took to execute from start to finish.
Attempts:
2 left
💡 Hint
Think about what 'elapsed time' usually means in timing contexts.
🧠 Conceptual
intermediate
2:00remaining
Identifying Query Failures from History
You want to find all queries that failed in the last 24 hours using Snowflake's query history. Which execution_status value should you filter for to get only failed queries?
A'SUCCESS'
B'CANCELED'
C'FAILED'
D'RUNNING'
Attempts:
2 left
💡 Hint
Think about the status that indicates a query did not complete successfully.
Architecture
advanced
2:00remaining
Optimizing Query Profiling for Large Workloads
Your Snowflake account runs thousands of queries daily. You want to efficiently analyze query performance trends over the past week without scanning the entire query history table. Which approach is best to reduce query time and cost?
AUse the QUERY_HISTORY function without any filters and rely on Snowflake to optimize automatically.
BUse the QUERY_HISTORY view with a filter on start_time to limit to the last week and select only needed columns.
CQuery the QUERY_HISTORY table without filters to get all data and then filter in your application.
DDownload the entire query history table and analyze it locally in a spreadsheet.
Attempts:
2 left
💡 Hint
Filtering early reduces data scanned and speeds up queries.
security
advanced
2:00remaining
Controlling Access to Query History Data
Which Snowflake role should you assign to a user to allow them to view query history but prevent them from modifying any data or running queries themselves?
AMONITOR
BSYSADMIN
CACCOUNTADMIN
DPUBLIC
Attempts:
2 left
💡 Hint
This role is designed for read-only monitoring tasks.
Best Practice
expert
3:00remaining
Interpreting Query Profile for Performance Bottlenecks
You examine the query profile for a slow-running Snowflake query. The profile shows a large amount of time spent in the 'Spilled to Disk' operation. What does this indicate and what is the best next step?
AThe query ran out of memory and spilled data to disk, slowing performance; increase warehouse size or optimize query to reduce memory use.
BThe query is waiting on network I/O; check network connectivity and retry.
CThe query is blocked by locks; kill blocking queries to proceed.
DThe query completed successfully with no issues; no action needed.
Attempts:
2 left
💡 Hint
Spilling to disk usually means memory limits were exceeded.