Let’s Get Certified
Module 08 / 13 · Analyze queries

Choose an optimization and verify correctness

Compare cache reuse, managed maintenance, clustering and changes to query semantics.

Choose an optimization and verify correctness

Work through the decision

A weekly report usually filters by depot and week. Older data was clustered on an unrelated key. One repeated run looks fast while the first query of the morning still scans nearly every file. What should the analyst measure?

Check your reasoning

Inspect query history, cache status, relevant predicates and files or bytes read on comparable executions. A warm result can conceal the cost of the physical scan. Capture the representative workload before considering clustering. Compare scan metrics after a supported layout change and validate that the answer is unchanged.

Watch the source lesson at 1:23:15

Compare the choices

Cached result reuse
Recognize when a compatible previous result is reused. Record input version, compute state and cache status in comparisons.
Predictive optimization
Use managed maintenance on eligible tables. Confirm feature eligibility and inspect operations and their costs.
Automatic liquid clustering
Consider automatic clustering for supported tables and workloads with evolving filters. Validate with representative scan metrics.
Semantic reconciliation
Compare known reference results and intermediate grains. Correct joins, null rules or boundaries before changing performance settings.

Test the decision

For eligible Unity Catalog managed tables, predictive optimization can manage maintenance. Automatic liquid clustering uses workload information for clustering choices on supported tables. Neither corrects a missing join predicate or an incorrect date boundary. Reconcile data at defined grain before interpreting performance gains.

Practice the guide skills

  1. A developer wants to reuse an earlier SQL statement. Does its old duration predict a cold run? Watch 1:23:15 · Continue at 1:24:58
    Check your answer

    Recover the statement and parameters from query history. Inspect cache use and compare runs with matching compute state and input versions.

  2. A large managed Delta table has changing filter patterns. How should the team decide on maintenance? Watch 1:28:24 · Continue at 1:29:13
    Check your answer

    Check access patterns, eligibility and existing layout. Predictive optimization manages supported table maintenance. Automatic liquid clustering can select clustering keys for eligible tables using observed workload patterns.

  3. A calculated revenue falls after a lookup table gains a row. Watch 1:30:22
    Check your answer

    Test keys and join direction, inspect unmatched records, and reconcile intermediate row counts and sums against a small reference output before tuning performance.

Official objectives for this lesson

Related lesson · Delta Lake

Knowledge check

Choose an optimization and verify correctness quiz

Answer 3 questions. Check each answer for an explanation.