Skip to content

docs: refresh stale EXPLAIN samples and fix invalid examples in the optimization and index pages - #38603

Draft
ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/optimization-index-docs
Draft

docs: refresh stale EXPLAIN samples and fix invalid examples in the optimization and index pages#38603
ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/optimization-index-docs

Conversation

@ggevay

@ggevay ggevay commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Motivation

EXPLAIN has defaulted to the physical plan since #33448 (2025-06), but the optimization page still shows a bare EXPLAIN producing "Optimized Plan" MIR output. Separately, two CREATE INDEX examples fail if you run them, and the shared index-limitations note contradicts the same page. Everything below was checked against a v26.39.0 emulator or the code.

Description

transform-data/optimization.md — three plan samples regenerated verbatim from v26.39.0:

  • The point-lookup sample showed MIR (ReadIndex on=… foo_x_y_idx=[lookup value=(42, 50)]). A bare EXPLAIN prints the fast-path arrow form, so the sample is now the real output (→Index Lookup on … / Lookup values: (42, 50)), and the surrounding prose no longer tells readers to look for lookup_value.

  • The two delta-join samples are reachable only via EXPLAIN OPTIMIZED PLAN FOR, so the commands say that. The regenerated output adds what a release build actually prints: humanized column names (#0{id}), // { arity: N } annotations, and the Target cluster: footer. The <---------- Delta join teaching callout is kept.

    (Using OPTIMIZED PLAN rather than switching the samples to the physical plan is deliberate: a bare EXPLAIN over a SELECT renders One-Shot Delta Join, a one-shot form that the index or materialized view the section is about would not use.)

Index usage types — the list omitted three variants that IndexUsageType renders (src/repr/src/explain.rs): plan root (no new arrangement), sink export, index export. Added, and the lead-in now says "most common" rather than "all possible".

headless/index-ordering.md (rendered on this page and on concepts/indexes) said indexes provide no optimization for LIMIT, contradicting the fast path limit usage type documented a few lines above it. Now carves out that exception.

sql/create-index.md:

  • "creates an in-memory index on a source, view, or materialized view" — the planner also accepts tables. Fixed in the page and in the two rendered syntax entries in data/examples/create_index.yml.
  • The active_customers example used now(), which cannot be materialized (cannot materialize call to current_timestamp, with a hint pointing at mz_now()); rewritten as the temporal filter mz_now() < last_active_on + INTERVAL '30' DAYS.
  • The "Speed up filtering" example had GROUP BY geo_id with two ungrouped columns, which fails to plan; the clause is dropped (the example only needs the columns).

sql/create-materialized-view.md — a duplicate include-from-yaml used the wrong parameter (file= instead of data=) and a name that does not exist, so it silently rendered nothing; the correct include is already a few lines above. Removed.

Retired links../../ops/optimization/, /overview/arrangements (×3), and the old Top K path now point at their current locations.

Verification

Prose and samples only. hugo builds cleanly. All three plan samples were captured from a v26.39.0 emulator using this page's own schema, and both failing CREATE INDEX examples were confirmed to error before the fix.

…ptimization and index pages

The optimization page's plan samples predate the change that made
`EXPLAIN` default to the physical plan, and two `CREATE INDEX` examples
do not run at all. Regenerated every sample against v26.39.0 and
corrected the examples, the index usage type list, and several retired
links.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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