Optimize PostgreSQL initialization performance#2237
Merged
danielaskdd merged 1 commit intoHKUDS:mainfrom Oct 21, 2025
Merged
Conversation
baa1939 to
410c430
Compare
- Batch index existence checks into single query (16+ queries -> 1 query) - Batch timestamp column checks into single query (8 queries -> 1 query) - Batch field length checks into single query (5 queries -> 1 query) Performance improvement: ~70-80% faster initialization (35s -> 5-10s) Key optimizations: 1. check_tables(): Use ANY($1) to check all indexes at once 2. _migrate_timestamp_columns(): Batch all column type checks 3. _migrate_field_lengths(): Batch all field definition checks All changes are backward compatible with no schema or API changes. Reduces database round-trips by batching information_schema queries.
410c430 to
2f22336
Compare
Collaborator
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Collaborator
|
Thanks for sharing. |
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.
Description
Optimizes PostgreSQL storage initialization by batching schema inspection queries. This reduces database round-trips by consolidating multiple
information_schemaqueries into single batched queries using PostgreSQL'sANY($1)array syntax.Related Issues
Addresses performance bottleneck during PostgreSQL storage initialization.
Changes Made
check_tables() - Batched Index Checking
ANY($1)_migrate_timestamp_columns() - Batched Column Type Checking
_migrate_field_lengths() - Batched Field Definition Checking
Backward Compatibility
Checklist
Additional Notes
Technical Implementation
ANY($1)syntax for array-based filteringrufflinting with no issues