Bird
0
0

Which of the following is the correct way to write a dbt model that selects only necessary columns to optimize cost?

easy📝 Syntax Q12 of 15
dbt - Performance Optimization
Which of the following is the correct way to write a dbt model that selects only necessary columns to optimize cost?
ASELECT * FROM raw_data
BSELECT id, name FROM raw_data
CSELECT COUNT(*) FROM raw_data
DSELECT id, name, age, address, phone FROM raw_data
Step-by-Step Solution
Solution:
  1. Step 1: Identify selecting necessary columns

    Choosing only needed columns reduces data scanned and processed.
  2. Step 2: Compare options for column selection

    SELECT id, name FROM raw_data selects only 'id' and 'name', fewer columns than options selecting all columns or more columns.
  3. Final Answer:

    SELECT id, name FROM raw_data -> Option B
  4. Quick Check:

    Select only needed columns [OK]
Quick Trick: Select only needed columns, not * [OK]
Common Mistakes:
MISTAKES
  • Using SELECT * which scans all columns
  • Selecting unnecessary columns increases cost
  • Confusing COUNT(*) with column selection

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes