ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 370 - Professional Data Engineer discussion

Report
Export

You are administering a BigQuery on-demand environment. Your business intelligence tool is submitting hundreds of queries each day that aggregate a large (50 TB) sales history fact table at the day and month levels. These queries have a slow response time and are exceeding cost expectations. You need to decrease response time, lower query costs, and minimize maintenance. What should you do?

A.
Build materialized views on top of the sales table to aggregate data at the day and month level.
Answers
A.
Build materialized views on top of the sales table to aggregate data at the day and month level.
B.
Build authorized views on top of the sales table to aggregate data at the day and month level.
Answers
B.
Build authorized views on top of the sales table to aggregate data at the day and month level.
C.
Enable Bl Engine and add your sales table as a preferred table.
Answers
C.
Enable Bl Engine and add your sales table as a preferred table.
D.
Create a scheduled query to build sales day and sales month aggregate tables on an hourly basis.
Answers
D.
Create a scheduled query to build sales day and sales month aggregate tables on an hourly basis.
Suggested answer: A

Explanation:

To improve response times and reduce costs for frequent queries aggregating a large sales history fact table, materialized views are a highly effective solution. Here's why option A is the best choice:

Materialized Views:

Materialized views store the results of a query physically and update them periodically, offering faster query responses for frequently accessed data.

They are designed to improve performance for repetitive and expensive aggregation queries by precomputing the results.

Efficiency and Cost Reduction:

By building materialized views at the day and month level, you significantly reduce the computation required for each query, leading to faster response times and lower query costs.

Materialized views also reduce the need for on-demand query execution, which can be costly when dealing with large datasets.

Minimized Maintenance:

Materialized views in BigQuery are managed automatically, with updates handled by the system, reducing the maintenance burden on your team.

Steps to Implement:

Identify Aggregation Queries:

Analyze the existing queries to identify common aggregation patterns at the day and month levels.

Create Materialized Views:

Create materialized views in BigQuery for the identified aggregation patterns. For example

CREATE MATERIALIZED VIEW project.dataset.sales_daily_summary AS

SELECT

DATE(transaction_time) AS day,

SUM(amount) AS total_sales

FROM

project.dataset.sales

GROUP BY

day;

CREATE MATERIALIZED VIEW project.dataset.sales_monthly_summary AS

SELECT

EXTRACT(YEAR FROM transaction_time) AS year,

EXTRACT(MONTH FROM transaction_time) AS month,

SUM(amount) AS total_sales

FROM

project.dataset.sales

GROUP BY

year, month;

Query Using Materialized Views:

Update existing queries to use the materialized views instead of directly querying the base table.

BigQuery Materialized Views

Optimizing Query Performance

asked 18/09/2024
Irving Indian
30 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first