Bird
0
0

A dbt model runs slowly and costs more than expected. The SQL is:

medium📝 Debug Q7 of 15
dbt - Performance Optimization
A dbt model runs slowly and costs more than expected. The SQL is:
SELECT customer_id, order_id FROM orders

What optimization can reduce costs?
ARemove GROUP BY clause
BAdd more columns to SELECT *
CAdd a WHERE clause to filter recent orders
DUse SELECT * instead of specific columns
Step-by-Step Solution
Solution:
  1. Step 1: Identify lack of filtering causing large data scans

    Without filtering, the query scans all orders, increasing cost and runtime.
  2. Step 2: Add a WHERE clause to limit data scanned

    Filtering recent orders reduces data scanned, lowering cost and improving speed.
  3. Final Answer:

    Add a WHERE clause to filter recent orders -> Option C
  4. Quick Check:

    Filter data to reduce cost = C [OK]
Quick Trick: Filter data to speed queries and save cost [OK]
Common Mistakes:
MISTAKES
  • Adding more columns increases cost
  • Removing GROUP BY irrelevant here
  • Using SELECT * loads unnecessary data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes