Skip to content

catalog: elide generated views inserted by other generators from mz_builtin_views - #38705

Draft
ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/elide-generated-builtin-views
Draft

catalog: elide generated views inserted by other generators from mz_builtin_views#38705
ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/elide-generated-builtin-views

Conversation

@ggevay

@ggevay ggevay commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Motivation

mz_builtin_views embeds every builtin view's definition and create_sql as literals, and replaces the text of the generated VALUES views with a placeholder, since their SQL is a mechanically produced list of every builtin and would otherwise be embedded a second time. The elision list was hardcoded to the three views generated next to it, so mz_object_dependencies_raw (#38252), a generated view inserted by another generator before this one runs, was embedded verbatim: 1.9 MB of the compact catalog dump, larger than the view itself, and about half of the dump growth between v26.40.1 and v26.41.0-rc.4. Part of SQL-689.

Description

make_builtin_views takes a slice instead of a fixed-size array, and builtins() extends the elision list with every view in builtin_items whose name is in a new GENERATED_BUILTIN_VIEWS constant, currently mz_object_dependencies_raw. Unlike the three views generated next to it, such a view is also yielded by the iterator over builtin_items, so make_builtin_views now skips generated views when emitting the full-definition rows; each view appears exactly once. The elided view keeps its row in mz_builtin_views; only its definition and create_sql become the placeholder, as for the existing generated views. test/sqllogictest/mz_views.slt lists the elided views and now includes it.

Verification

bin/sqllogictest --optimized on mz_views.slt, mz_object_dependencies.slt, oid.slt, catalog_server_explain.slt, information_schema_tables.slt and mz_catalog_server_index_accounting.slt passes (433 of 433 statements; the dependency counts, the 194-row constant plan and the oid list are the checks that would catch a duplicated or missing row). cargo clippy -p mz-catalog --all-targets -- -D warnings is clean.

🤖 Generated with Claude Code

…uiltin_views

mz_builtin_views lists every builtin view's definition and create_sql as
string literals, except for the generated VALUES views, which get a
placeholder because their text is a mechanically produced list of every
builtin and would be embedded a second time. The elision list was fixed
to the three views built next to it, so mz_object_dependencies_raw, a
generated view inserted by another generator, was embedded verbatim: 1.9
MB of the catalog dump, more than the view itself. Elide it by name, and
keep the names of such views in one constant so the next generated view
is added there.

Part of SQL-689.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ggevay
ggevay force-pushed the gabor/elide-generated-builtin-views branch from d2affa9 to dce58ad Compare September 7, 2026 19:34
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