tree: make int::regtype::text O(1)#40267
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Aug 28, 2019
Merged
Conversation
Member
Previously, casting an integer to a regtype and then text (which turns a type OID into the string of its corresponding type) would run a select over pg_type to figure out the answer, which under the hood materializes all of the types into a table and filters, an O(n) operation. This is silly because we already have a static lookup table for this info. Use it. This commonly shows up in visualization tools as O(n^2), since people tend to run one of these casts once per type. So this improves metadata query performance significantly. Release note: None
fbf0321 to
79226f6
Compare
Member
Author
|
bors r+ |
craig bot
pushed a commit
that referenced
this pull request
Aug 28, 2019
40234: storage: test atomic replication changes r=nvanbenschoten a=tbg This PR adds a number of tests that focus on the interaction between the various queues and joint configurations. We don't flip the switch yet since adding/removing only learners does not work yet via the joint path. This isn't something we need per se, but it's an annoying restriction to keep in mind and work around if it does happen. Tracked in #12768 (comment). 40267: tree: make int::regtype::text O(1) r=jordanlewis a=jordanlewis Previously, casting an integer to a regtype and then text (which turns a type OID into the string of its corresponding type) would run a select over pg_type to figure out the answer, which under the hood materializes all of the types into a table and filters, an O(n) operation. This is silly because we already have a static lookup table for this info. Use it. This commonly shows up in visualization tools as O(n^2), since people tend to run one of these casts once per type. So this improves metadata query performance significantly. Release note: None Co-authored-by: Tobias Schottdorf <tobias.schottdorf@gmail.com> Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
Contributor
Build succeeded |
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.
Previously, casting an integer to a regtype and then text (which turns a
type OID into the string of its corresponding type) would run a select
over pg_type to figure out the answer, which under the hood
materializes all of the types into a table and filters, an O(n)
operation. This is silly because we already have a static lookup table
for this info. Use it.
This commonly shows up in visualization tools as O(n^2), since people
tend to run one of these casts once per type. So this improves metadata
query performance significantly.
Release note: None