QUERY BUDGET · PARTITION PRUNING

BigQuery-style query budget: filter before scanning

Estimate the bytes a BigQuery-style query reads from a partitioned table, then cap it, prune it and drop unneeded columns.

Computed drill · sixty inspection seconds

Event trace

    Computed data

    Final metrics

    A fictional table with invented column sizes; nothing runs on Google Cloud and no prices are shown. It models columnar billing, partition pruning only on the partitioning column, LIMIT not reducing bytes read on an unclustered table, and a byte cap that fails the query before it reads data. Clustering, caching, minimum billing and slot pricing are not modeled.

    A filter that prunes nothing

    The table has 365 daily partitions on event_date, 4 GiB each, stored by column. The question is total amount by country for the last 30 days. The default query is SELECT * with Date range Last 30 days, Date filter on DATE(event_ts) and LIMIT 100. The filter is not on the partitioning column, so all 365 partitions are read: 1460 GiB, 88.5 times the 16.5 GiB the answer needs: WASTEFUL SCAN.

    Columns and partitions

    Only country and amount, still filtered on event_ts, reads country, amount, event_date and event_ts from every partition: 273.75 GiB, 16.6 times the minimum. Filtering on event_date with SELECT * prunes to 30 partitions but reads every column: 120 GiB. Both fixes together read 16.5 GiB: EFFICIENT. With All time selected, the needed columns cost 200.75 GiB and that is the minimum.

    LIMIT, dry runs and caps

    Untick Add LIMIT 100: the bytes do not change, because LIMIT trims returned rows, not data read. Dry run first adds an event reporting the estimate without billing. Set maximum_bytes_billed to 100 GiB: the original query fails before reading any data and nothing is billed, BLOCKED BY CAP. A 2000 GiB cap lets the 1460 GiB scan run.

    Reading the bars

    The board compares the estimated scan, the minimum for this answer and the bytes billed, next to the query plan. The table lists each column, its size per partition and whether it was read. The plan chips turn red for SELECT * and for a filter that cannot prune. A dry run reports the bytes a query would process, including partition pruning, so it catches this mistake before anything is billed.

    Replay and limits

    Any change recomputes the run and rewinds it; the Complete-run preview states the outcome at once. Play and Pause walk through the events, Next event jumps one event, Restart rewinds, Speed runs from 0.25x to 2x and Inspection time seeks from 0 to 60 seconds, where the outcome and final metrics appear. A fictional table with invented column sizes; nothing runs on Google Cloud and no prices are shown. Clustering, caching and minimum billing are not modeled.