Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Google Cloud · Professional Data Engineer

Data for BI, and query performance

Professional Data Engineer · Lesson 16 of 23 · 1:59:28

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Google Cloud Professional Data Engineer exam, on the official exam guide. In this lesson: connecting Data Studio, Connected Sheets, Looker, and JDBC or ODBC tools, precalculating fields and aggregate tables, BI Engine and materialized views, and troubleshooting slow queries with the execution graph and performance insights. Includes three original practice questions, with Cymbal Mobility, a fictional ride-hailing and scooter company, as the example.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Slow city dashboards

Cymbal Mobility's city managers open their dashboards every morning, and each one takes twenty seconds to load. Every chart computes the same totals again, over billions of trips, and the bill grows with each view. The data engineer must make the data ready for business intelligence, and make the queries fast.

Connecting BI tools

Analysts reach BigQuery data through many tools. Data Studio, formerly Looker Studio, builds interactive dashboards and reports, and connects to BigQuery directly. Connected Sheets brings BigQuery data into Google Sheets, with pivot tables, formulas, and charts, refreshed on request or on a schedule. Looker adds a governed semantic layer, so every team uses the same definitions of its metrics. Other tools connect through the JDBC and ODBC drivers, or the BigQuery API.

Precalculating fields and aggregates

Dashboards run the same calculations again and again, so precalculate what they need. Add derived fields during transformation, like the duration of each trip, or the city of each station, instead of computing them in every chart. Build aggregate tables at the grain the dashboard shows, like trips per city per hour, refreshed by a scheduled query or by Dataform. And keep the detailed tables for drill-down, so users can still explore.

BI Engine and materialized views

BI Engine is a fast, in-memory analysis service that speeds up many SQL queries, by caching the data used most often. You create a reservation in a region, set its size, and can choose preferred tables, so the memory goes to the data that matters. It works best with partitioned and clustered tables, so only the recent partitions are loaded. A materialized view stores precomputed results, and BigQuery refreshes it in the background, adding recent changes from the base tables, so results stay fresh. With smart tuning, a query on the base table can be rerouted to the materialized view automatically, with no change to the query.

Troubleshooting slow queries

When a query is slow or expensive, start with what it reads. Select only the columns you need, since a limit clause does not reduce the data read, then filter early on partition and cluster columns, and reduce data before a join. Next, open the execution graph, which shows each stage of the query, and the data passed between stages through shuffle. Performance insights flag slot contention, high cardinality joins, partition skew, and insufficient shuffle quota. Partition skew means a few very frequent key values make some partitions much larger than others, and one slot must process each of them alone. And cached results help too: an identical query on unchanged tables reuses its results for about a day, at no charge.

Recap

Let's recap. Connect BI tools through Data Studio, Connected Sheets, Looker, or the JDBC and ODBC drivers. Precalculate derived fields, and aggregate tables at the grain the dashboards show. BI Engine caches the most used data in memory, for the preferred tables of a reservation. Materialized views stay fresh, and smart tuning reroutes queries to them. And for slow queries, read less data first, then use the execution graph and performance insights.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. Every chart of a dashboard computes trip durations from two timestamps, over billions of rows, and the same daily totals are computed hundreds of times a day. What should the data engineer do?

    • Add more charts that each filter the raw trips table
    • Export the raw table to a spreadsheet each day
    • Refresh the dashboard every minute
    • Precompute durations and daily aggregate tables
    Show the answer

    Precompute durations and daily aggregate tables

    Precompute the duration once in the pipeline, and serve the dashboard from daily aggregate tables. “Add more charts that each filter the raw trips table” would still compute everything again, in more charts. “Export the raw table to a spreadsheet each day” would create stale copies, outside BigQuery. And “Refresh the dashboard every minute” would run the same heavy queries even more often.

  2. A dashboard runs the same aggregation of trips per city, over a large table, hundreds of times a day. Results must include the latest trips, and the dashboard’s queries cannot be rewritten. What should the data engineer create?

    • A materialized view with the aggregation
    • A table rebuilt each night by a scheduled query
    • A logical view with the aggregation
    • An authorized view on the base table
    Show the answer

    A materialized view with the aggregation

    A materialized view precomputes the aggregation, stays fresh, and smart tuning reroutes the existing queries to it. “A table rebuilt each night by a scheduled query” would miss every trip since the last nightly run. “A logical view with the aggregation” would compute the full aggregation again, at every query. And “An authorized view on the base table” controls who can read the data, not how fast it is.

  3. A query that joins trips with stations runs for a long time. The join stage is flagged, because a handful of station IDs appear in millions of rows, while most appear in a few. What is the most likely issue?

    • Slot contention from other jobs
    • An expired query results cache
    • Partition skew on the join keys
    • A missing BI Engine reservation
    Show the answer

    Partition skew on the join keys

    A few frequent key values create oversized partitions, which is partition skew on the join. “Slot contention from other jobs” describes a lack of available slots, not uneven keys. “An expired query results cache” would only make a repeated query run again, at normal speed. And “A missing BI Engine reservation” concerns dashboard acceleration, not the distribution of join keys.