Skip to main content

Partial Execution

Execute queries up to a specific CTE to test intermediate results.


Gutter Icons

Diamond icons (◆) appear in the left margin at each CTE boundary:

WITH user_events AS (
SELECT user_id, event_type FROM events
),
◆ recent_users AS (
SELECT user_id, COUNT(*) as event_count
FROM user_events
GROUP BY user_id
)
SELECT * FROM recent_users WHERE event_count > 10;

Actions

ActionHow
Estimate costClick gutter icon
Execute to this CTEShift+Click gutter icon

Use Cases

Testing CTEs Step by Step

  1. Shift+Click first CTE icon → verify data
  2. Shift+Click next CTE icon → verify transformation
  3. Run full query when all CTEs validated

Debugging Unexpected Results

Execute to each CTE to find where data goes wrong.

Cost Control

Click (not shift) to estimate cost before executing expensive CTEs.


How It Works

When you Shift+Click on user_events, Querylab.io executes:

WITH user_events AS (
SELECT user_id, event_type FROM events
)
SELECT * FROM user_events; -- Auto-added

Limitations

  • Only works on top-level CTEs (not nested WITH)
  • Final SELECT also has a gutter icon for full execution