perf(Schema): batch table introspection queries - #262
Merged
Conversation
fix(Postgres): resolve native enum values by type schema — an enum type outside the search_path resolved to a same-named type instead Introspection issued a query per column and per constraint, so a wide table cost dozens of round trips. Constraints are now fetched once per table and dispatched in PHP, and the index query is shared between fetchIndexes() and fetchPrimaryKeys(); AbstractTable::resetIntrospectionCache() drops that state before a read and after DDL. The per-column queries stay as a fallback: the new createInstance() arguments are optional, so third-party callers are unaffected. Assisted-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 2.x #262 +/- ##
============================================
- Coverage 95.73% 95.48% -0.26%
- Complexity 2078 2119 +41
============================================
Files 141 141
Lines 5862 5974 +112
============================================
+ Hits 5612 5704 +92
- Misses 250 270 +20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…m types The batched pg_enum lookup returns labels with commas, quotes and spaces verbatim, and reports a label-less enum column as a non-enum; the former enum_range() text parsing mangled both cases. Assisted-By: Claude Fable 5 (1M context) <noreply@anthropic.com>
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.
🔍 What was changed
fetchIndexes()andfetchPrimaryKeys(). Introspecting a 40-column table drops from dozens of round trips to a handful.AbstractTable::resetIntrospectionCache()hook clears the memoized state before a schema is read and after DDL is applied.pg_enuminstead ofenum_range()over thesearch_path. This fixes three bugs of the old text-based parsing:'a,b','it''s') were split incorrectly — they are now returned verbatim;The per-column queries stay as a fallback: the new
createInstance()arguments are optional, so third-party callers are unaffected.Why?
Introspection cost one query per column and per constraint, which dominates schema sync against a remote database.
Checklist