Docs /SQL Editor /Partial execution
SQL EditorCost

Partial execution

Run or price a query up to one CTE, one pipe stage, one subquery, or one statement, straight from the editor gutter. Check what a CTE returns without rewriting the query around it.

Query 1
1234567891011121314
WITH failed_tests AS (
SELECT vehicle_id, vehicle_snapshot.make, vehicle_snapshot.model,
       defects, completed_date
FROM `ace-analytics.warehouse.fact_mot_test`
WHERE completed_date >= '2025-09-01' AND test_result = 'FAILED'
),
dangerous_defects AS (
SELECT f.vehicle_id, f.make, f.model, d.defect_type, d.parsed.category
FROM failed_tests AS f, UNNEST(f.defects) AS d
WHERE d.is_dangerous = TRUE
)
SELECT make, model, COUNT(*) AS n
FROM dangerous_defects
GROUP BY make, model
dangerous_defects — Estimated
Cost$0.00
Bytes451.39 MB

WITH failed_tests AS ( … ), dangerous_defects AS ( SELECT f.vehicle_id, f.make, f.model, d.defect_type, d.parsed.category FROM failed_tests AS f, UNNEST(f.defects) AS d WHERE d.is_dangerous = TRUE ) SELECT * FROM dangerous_defects

Click: Re-estimate • Shift+Click: Run
✓$0.00 | 0.14 ms elapsed, 0 B

Estimating or running from the gutter

A grey diamond appears in the left margin on every line that starts an execution boundary.

BoundaryIcon sits on
CTEThe name AS ( line of each WITH entry
Pipe stageEach |> line of a pipe query
SubqueryThe opening line of a subquery in FROM or WHERE
Set-operation branchEach side of a UNION / INTERSECT / EXCEPT
StatementThe first line of each statement in a script
The final SELECTThe whole query; same as Run Query
  • Click the diamond to dry-run the query up to that boundary. The diamond turns into a green $; hover it for the bytes and cost.
  • Shift-click to run it. Results replace the results panel like any other run, and are subject to the tab’s cost limit.
  • Hover the diamond to see the SQL that will be sent, with the other CTE bodies collapsed to ....

Editing the query clears the estimates.

What gets sent

For a CTE, everything up to and including that CTE, followed by SELECT * FROM <name>:

1234567
WITH failed_tests AS (
SELECT vehicle_id, vehicle_snapshot.make, vehicle_snapshot.model,
       defects, completed_date
FROM `ace-analytics.warehouse.fact_mot_test`
WHERE completed_date >= '2025-09-01' AND test_result = 'FAILED'
)
SELECT * FROM failed_tests
What Shift-click on failed_tests runs. The later CTEs and the final SELECT are dropped.

For a pipe stage, the query is cut after that |> line. For a subquery, the subquery itself runs as a top-level query. For a statement in a script, that statement alone runs, with any DECLARE and SET above it prepended so its variables resolve. A SELECT that reads a temp table created earlier in the script still needs the whole script, or a selection that includes the CREATE.

Filters from later in the query are pushed into the partial query where they apply (the same Filter Propagation switch as the Insights panel), so the estimate for a CTE reflects the WHERE you wrote on it downstream.

Running a selection instead

Select any text and press ⌘Enter (CtrlEnter on Windows and Linux): only the selection runs. That’s the tool for one statement out of a script, or for a CTE body pasted on its own. A tab-level TABLESAMPLE directive still applies to the selection. With nothing selected, ⌘Enter runs the whole tab.

Checking a query section by section

Click each diamond top to bottom to see which section carries the bytes, then Shift-click the CTEs in order and check their rows; the first one with wrong output is where the problem is. Analyze in the cost view of the Insights panel dry-runs every boundary in one click.