Analysts always read orders together with their line items. Joining two large normalized tables in BigQuery is slow. What data model change fits?
- Exam domain
- Storing the data~20% of the exam
- Difficulty
- Medium
- In this mock
- 12 questions on this domainPractise this domain
Why the exam asks this
Storing the data: Planning for using a data warehouse.
Objective in the exam guide: Designing the data model.
Access patterns should shape the model.
Why A is the answer
Store line items as a nested, repeated field inside each order row
BigQuery recommends nested and repeated fields to denormalize data and reduce joins.
How it works
Denormalization adds data to one table to reduce joins.
BigQuery recommends nested and repeated fields for this.
The model should follow business access patterns.
Clues in the question
The words that point to the answer, and what each one tells you.
- Always read together
- Nest.
- Join is slow
- Remove it.
In detail
- Model around how the business reads the data.
- Keep separate tables for data that changes independently.
Side by side with look-alikes
| Change | Removes the join? |
|---|---|
| Nested, repeated field | Yes |
| More tables | No |
| Memorystore | Wrong store |
| Second copy | No |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Store line items as a nested, repeated field inside each order rowRight
BigQuery recommends nested and repeated fields to denormalize data and reduce joins.
B. Split line items into even more tablesWrong
More tables mean more joins.
C. Move orders to MemorystoreWrong
A cache does not suit analytics.
D. Add a second copy of the line items tableWrongMost tempting
A copy adds storage without removing the join.
Why it tempts: Copies can speed reads elsewhere. But the join remains.
In practice
- Write down the top queries before designing tables.