Query Profiling and Optimization with dbt
📖 Scenario: You work as a data analyst for an online store. Your team uses dbt to manage SQL queries that prepare sales data for reporting. Some queries run slowly, and you want to profile and optimize them to improve performance.
🎯 Goal: You will create a dbt model with sales data, add a configuration to limit data for faster testing, optimize the SQL query by filtering and aggregating efficiently, and finally run the model to see the optimized output.
📋 What You'll Learn
Create a dbt model SQL file with a SELECT query from the
raw_sales tableAdd a config variable
limit_rows to limit rows for profilingOptimize the query by filtering sales with amount greater than 100 and grouping by product
Print the final aggregated sales per product
💡 Why This Matters
🌍 Real World
Data analysts and engineers often need to profile and optimize SQL queries in dbt to improve data pipeline speed and efficiency.
💼 Career
Skills in query optimization and dbt modeling are valuable for roles like data analyst, data engineer, and analytics engineer.
Progress0 / 4 steps