Google Professional Data Engineer Question 146
Single answerGoogle Cloud PlatformYou are designing a database schema for an online retail system on Google Cloud. The system must support real-time analytics for customer purchases while minimizing query latency. Given this requirement, how should you decide the degree of data normalization?
- A
Fully normalize the database to eliminate redundancy and maintain data integrity.
- B
Use a denormalized schema to reduce the number of joins and improve query performance.
- C
Implement a hybrid approach where frequently queried data is denormalized, while less critical data remains normalized.
- D
Normalize the database but rely on a caching layer to improve query performance.
Show answer and explanation
Correct answer: B
Explanation
For real-time analytics, minimizing query latency is critical. Denormalization is the most effective way to achieve this as it reduces the need for joins, which are often the bottleneck in query performance. While normalization can enhance data integrity, it is not optimal for real-time analytics where speed is prioritized.
- A. Incorrect.
Fully normalizing the database can increase the number of joins required for queries, which may lead to higher query latency. This would not be ideal for real-time analytics.
- B. Correct.
Using a denormalized schema reduces the need for joins, which significantly improves query performance for real-time analytics, making it the most suitable choice in this scenario.
- C. Incorrect.
A hybrid approach may work in some cases, but it would add complexity to the system and is not the best solution for minimizing query latency in real-time analytics.
- D. Incorrect.
While normalization with caching can help improve performance, it adds extra complexity in managing the cache and may not be sufficient for real-time analytics requiring minimal latency.