-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61820: sql/catalog/descs: use allDescriptors as a negative cache for by-ID lookups r=ajwerner a=ajwerner When doing introspection queries we tend to pull and cache the complete set of descriptors. This powers subsequent calls to various virtual tables. However, we also often need to grab descriptors by ID. This happens in some of the virtual indexes and it especially happens in the call to `pg_table_is_visible`. When that function was called on all of the oids in pg_class it was forced to make a bunch of kv lookups; namely one for each and every index and virtual table (depending on the query plan). We can short-circuit all of that with a map of descriptors we are already holding in memory. Before this change, the django introspection query was doing O(indexes) lookups and now it is doing 2. Release note (performance improvement): Reduce the number of round-trips required to call `pg_table_is_visible` in the context of pg_catalog queries. Co-authored-by: Andrew Werner <[email protected]>
- Loading branch information
Showing
3 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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