Skip to content

Add an opt-in concise query-plan metadata mode via spannerplan #764

Description

@apstndb

Goal and maintainer decision (2026-09-15)

Offer an opt-in concise metadata mode for EXPLAIN / EXPLAIN ANALYZE. Do not generally suppress seekable_key_size: 0 or the reported automatic scan_method: these values can carry useful information, and whether they should be omitted by default is unresolved. Preserve the existing default display of these fields.

The implementation belongs in apstndb/spannerplan first. spanner-mycli may expose the upstream mode once it exists; it should not fork or postprocess upstream notation emitters to hide fields.

This decision supersedes the earlier proposal to make a new concise form the default and rely on CLI_SPANNER_CLI_COMPATIBLE_PLAN=true to recover the old form.

Motivation

Verbose per-node metadata can widen plans in constrained terminals and documentation. Users who prefer a shorter display should be able to choose it without removing information from the normal display for everyone.

Examples in existing plan fixtures include:

  • seekable_key_size: 0
  • scan_method: Automatic

The user's concern applies to the automatic scan-method notation generally; preserve exact metadata values rather than assuming an undocumented value spelling.

Bounded implementation direction

  1. Add an explicit optional mode to spannerplan's metadata rendering. Define and test its exact omissions/abbreviations against representative plan fixtures before adoption.
  2. Preserve current default output. A zero seekable key size and an automatic scan method must remain visible by default where they are visible today.
  3. In the opt-in mode, consider omitting zero seekable-key size and automatic scan-method annotations; preserve nonzero, nondefault and unknown values. Do not mutate the underlying plan or exported raw metadata.
  4. After an upstream release contains the mode, wire a deliberate spanner-mycli setting and document the tradeoff and interaction with existing plan compatibility/format controls. Select the setting name and enum/boolean shape in that implementation design.
  5. Keep full and concise rendering tests together, including default preservation and unknown metadata. Use one PR per independent upstream/downstream change.

Already implemented / exclusions

Current concise boolean notation already suppresses false values such as split_ranges_aligned: false and displays true as split_ranges_aligned; this is documented in docs/query_plan.md. Historical wide examples do not prove that behavior is missing. Do not reimplement it or use this task to change its default.

No blanket metadata suppression, new concise default, raw-plan data loss, or local mycli renderer fork. This remains a backlog item; it is not part of the current #292 operation-eligibility implementation.

Origin

Extracted from the EXPLAIN umbrella #182 (remaining metadata notation work). Foundation notation work shipped in #185. Rendering largely lives in apstndb/spannerplan (and spannerplanviz).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestoutput-formattingOutput format and display improvements

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions