Docs
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. It's how you check what a CTE returns without rewriting the query around it, and how you find which section is scanning the terabyte.

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_defectsClick: 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. Nothing else in the margin is clickable.

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 ....

Estimates are kept per boundary and discarded the moment you edit the query, so a $ you can see is always for the text you can see.

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. A filter combined with OR, or containing a subquery, stays where it is.

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

  1. Click each diamond top to bottom. The $ values tell you which section carries the bytes before anything runs.
  2. Shift-click the first CTE and look at the rows. If they’re right, Shift-click the next one.
  3. When a CTE’s output is wrong, it’s in that CTE, not upstream; everything above it just checked out.
  4. Run the whole query once at the end.

The cost view of the Insights panel does step 1 for you in one click: Analyze dry-runs every boundary and lists them together. The gutter is for when you already know which section you’re looking at.