Investigating slow queries
Harbr's platform team monitors query performance to keep warehouse costs under control. They use a query log to surface the most expensive queries. The logistics.query_log table mirrors the structure of Snowflake's ACCOUNT_USAGE.QUERY_HISTORY view and contains columns query_id, warehouse_name, execution_ms, bytes_scanned, query_type, and status.
Your task is to identify the top 5 slowest queries.
This exercise is part of the course
Data Pipeline Automation in Snowflake
Exercise instructions
- Select
warehouse_name,execution_ms, andbytes_scannedfromlogistics.query_log. - Order by
execution_msin descending order and limit the results to 5 rows.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
-- Find the 5 slowest queries by execution time
SELECT
___,
___,
___
FROM logistics.query_log
ORDER BY ___ DESC
LIMIT ___;