Repository navigation
Conversation
Use persistent ordered maps inside databases and schemas so mutating one object does not clone every sibling namespace entry. Keep the SQL catalog schema-ID interface independent of the map representation.
aljoscha
force-pushed
the
aljoscha/ddl-nested-catalog-maps
branch
from
December 2, 2026 09:43
adeb0bf to
eb24935
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Catalog snapshots share their outer maps, but modifying a database or schema still clones ordinary nested maps. The copying cost grows with the number of schemas and objects, even for one CREATE or DROP.
Description
Use the existing persistent ordered-map implementation for database schema lookups and schema item, function and type namespaces. Mutation retains copy-on-write snapshot isolation and deterministic iteration. The SQL catalog's schema-ID interface returns an iterator instead of exposing a concrete map type, so the local compiler catalog can retain its own representation.
Stacked on #41301.
Verification
Adds a catalog-boundary regression covering snapshot isolation across database, ambient and temporary schemas, separation of item/function/type namespaces, schema-name ordering, and preservation of children across durable schema and database replacements. Existing SQL tests cover same-name function/type/item lookup (
regproc.slt,regtype.slt,types.slt), schema search paths and temporary objects.Performance
Original comparison and reversed comparison, baseline
e7bf89e8and candidateeb24935d. Mixed 5k/10k/30k catalogs, ordinary table/view/index CREATE/DROP, 1/8 clients, two clean 20-second repetitions per cell. Profiled repetitions are excluded. Both arms of each pair use the same ARM64 node and 2-CPU/16-GiB limits, with matching configuration.The reversed pair has 13/18 throughput improvements and five regressions, versus six improvements and 12 regressions originally. CREATE/DROP p95 regresses in 11/36 comparisons, versus 22/36 originally. Reversed-run throughput changes:
The strongest repeated gains are 30k/c8 views (+11.22%, +11.34%) and indexes (+7.31%, +7.60%). Tables at 30k/c8 regress in both orders (-3.15%, -2.48%). The largest reversed-run p95 increase is 30k table/c8 CREATE, +12.14%. Seven original throughput regressions change direction. These observations support limited workload-specific benefits, not a general DDL speedup.
The reversed run additionally disables periodic configuration sync after verified initialization. Because the protocols differ, these pairs are not pooled as an order-only crossover. The remaining small-catalog regressions are not dismissed as noise.
Original workload profiles contain nested Database/Schema clone frames in 186/6,254 baseline weighted samples and 0/6,176 candidate samples. These are sample counts, not seconds. Unresolved frames and residual persistent-map work remain. Zero observed does not mean zero cost. CPU attribution bounds overlap in every reversed-run cell. CPU includes background work, and telemetry coverage is partial, including a missing candidate 30k/index/c1/repetition2 CPU/timer interval. No general memory or exact CRDB-call reduction is established.
Keep this PR draft. Broader performance claims require independent repetitions under one fixed protocol.
Release notes
None.