Skip to content

console: show Materialize's execution time next to the round trip - #39564

Draft
ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/console-execution-time
Draft

ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/console-execution-time

Conversation

@ggevay

@ggevay ggevay commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Draft, 100% Claude

Motivation

Part of CNS-170. The SQL Shell shows "Returned in X", a round trip measured in the browser. On a slow network, a query served from an index looks as slow as one that runs a dataflow. Materialize can report its own execution time per statement (the emit_execution_time_notice session variable, separate PR). The Shell now shows it next to the round trip.

Description

  • Opt-in.
    • The Shell sets emit_execution_time_notice=on when it connects.
    • An environment that does not know the variable answers with a startup notice ("unrecognized configuration parameter"). The Shell hides any such failure to apply the variable and shows the round trip alone.
  • Notice handling.
    • A notice with code MZ012 is stored as the result's execution time instead of being listed with the result's notices.
    • The server sends it before the statement's CommandComplete, so it lands on the statement it describes.
    • An MZ012 notice the Shell cannot parse, for example of a kind added later, is dropped, which leaves the round trip alone.
    • Fixes a typo in the state machine: a notice during a statement without rows no longer moves it to the state for statements with rows.
  • Display.
    • Example: Returned in 148.0ms · 12.0ms to first row (served from an index).
    • The label depends on the kind: to first row, to empty result, in Materialize, before or including commit.
    • The execution strategy is named for reads.
    • Times below 0.1 ms show as <0.1ms.
    • The tooltip explains both numbers.
  • No feature flag. The variable is opt-in on the server, and the Shell ignores environments without it. Reverting this change is the off switch.
  • Docs. sql-shell.md gains a "Query timing" section.

User-visible effect: below each result, the SQL Shell shows Materialize's own execution time next to the round trip, on environments that report it.

Verification

  • executionTime.test.ts (new): parsing, every kind's label, unknown strategies, sub-0.1 ms times, and the filter for a failed startup setting.
  • webSocketFsm.test.ts: an MZ012 notice becomes the latest result's execution time and is not listed as a notice. An MZ012 notice whose detail does not parse is dropped.

🤖 Generated with Claude Code

@ggevay
ggevay force-pushed the gabor/console-execution-time branch from 35d3267 to 259eb7d Compare October 5, 2026 21:56
The SQL Shell opts in to the `emit_execution_time_notice` session
variable when it connects. It stores the `MZ012` execution time notice
on the result it describes, and shows that time next to the round trip
measured in the browser, labeled by kind and execution strategy.
Environments that do not know the variable answer with a startup
notice, which the Shell hides, and keep showing the round trip alone.

Part of CNS-170.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ggevay
ggevay force-pushed the gabor/console-execution-time branch from 259eb7d to 1ac1395 Compare October 12, 2026 11:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant