Skip to content

perf(connections): read the catalog side kinds in one round trip per engine - #4576

Merged
datlechin merged 3 commits into
mainfrom
perf/catalog-side-kinds-one-trip
Nov 26, 2026
Merged

datlechin merged 3 commits into
mainfrom
perf/catalog-side-kinds-one-trip

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • After the table list, the catalog load read schemas, routines, triggers, types and server objects on one lease and one round trip each, one after another. It now asks the driver for every side kind in one call, on one lease, and commits each kind's answer as before; each kind still fails alone.
  • PluginKit gains fetchCatalogSideObjects(_:) with a default that asks each kind in turn, so every plugin keeps working unchanged. Additive; the kit stays at 47, already one past the 46 the newest tag shipped. PluginDriverAdapter bridges it and stamps and sorts each kind exactly as the kind's own fetch does.
  • PostgreSQL answers it with one simple Query under one SET LOCAL search_path (LibPQDriverCore.executeCatalogReads). A statement that fails stops the Query, and the core sends each read it never reached alone, so one refused kind costs the others nothing.
  • The refresh path uses the same call, so a DDL-triggered refresh also pays one round trip for the side kinds.
  • The database list is read beside the catalog load instead of after every side kind, and completion's namespaces sync once it has landed.

Measured from the code path on PostgreSQL: the side kinds go from 5 Queries (schemas, routines, triggers, types, extensions) to 1, so the load after the table list drops from 5 round trips to 1. Signpost timings at +50 ms and +200 ms were not run here. MySQL keeps the one-by-one default for now; its pipelined read is left for a follow-up, noted on the issue.

SchemaLeasingLoadTests pinned one lease per side kind and a column read slipping between two kinds; this PR changes both on purpose, and the updated cases say so.

Test plan

  • CatalogSideObjectsBatchTests (new): a load asks the driver once for every side kind on one lease after the tables, and a kind that fails leaves the others committed. Fails on main.
  • SchemaLeasingLoadTests (updated), SchemaService*Tests, SchemaRefreshServiceTests.
  • verify.sh plugins and verify.sh abi for the PluginKit addition.

Closes #4543

…engine

The catalog load asks the driver for every side kind in one call on one lease; PluginKit gains fetchCatalogSideObjects with a one-by-one default, and PostgreSQL answers it with one Query. The database list is read beside the load.
@datlechin
datlechin enabled auto-merge (squash) November 26, 2026 01:50
@datlechin
datlechin merged commit baf645f into main Nov 26, 2026
11 checks passed
@datlechin
datlechin deleted the perf/catalog-side-kinds-one-trip branch November 27, 2026 16:37
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.

perf(connections): read the catalog side kinds in one round trip per engine

1 participant