-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
builtins: implement pg_table_is_visible as UDF #94339
Conversation
dab9289
to
cb153a4
Compare
UDF team - is this a valid thing to do? Do you understand why the performance would be improved? @mgartner @chengxiong-ruan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems valid to me. Perhaps inefficiencies in the internal executor explain the speed up from this change?
cb153a4
to
d29ac16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to get pg_type_is_visible
and pg_function_is_visible
while you're here?
d29ac16
to
3028f15
Compare
Done |
d8d7c32
to
4a472d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis)
pkg/sql/pg_catalog.go
line 3335 at r1 (raw file):
// table. We have special logic for this case. if typDesc.GetKind() == descpb.TypeDescriptor_TABLE_IMPLICIT_RECORD_TYPE { table, err := p.Descriptors().GetImmutableTableByID(ctx, p.txn, id, tree.ObjectLookupFlags{})
does this part also need to check for dropped tables?
4a472d5
to
86ed161
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @rafiss)
pkg/sql/pg_catalog.go
line 3335 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
does this part also need to check for dropped tables?
Good point, fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Reviewable status:
complete! 0 of 0 LGTMs obtained
@@ -175,7 +175,6 @@ func (v TableImplicitRecordType) Adding() bool { | |||
|
|||
// Dropped implements the Descriptor interface. | |||
func (v TableImplicitRecordType) Dropped() bool { | |||
v.panicNotSupported("Dropped") | |||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this instead delegate to the wrapped table descriptor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
86ed161
to
2404b3f
Compare
Previously, the pg_proc and pg_type virtual indexes would show cross-db objects, which is not supposed to happen. This is now corrected. Release note (bug fix): the pg_proc and pg_type virtual oid indexes no longer incorrectly show cross-db objects. This is unlikely to affect real-world use cases.
Now that we support UDFs, we can implement builtin functions as "virtual UDFs", that are defined in the builtins map. The builtin appears to be about twice as fast with this method, which is nice because it gets used a lot in ORM introspection queries. Epic: None Release note (performance improvement): improve the performance of pg_{function,table,type}_is_visible Co-authored-by: rafiss <[email protected]>
Release note: None
2404b3f
to
d363b40
Compare
bors r+ |
Build succeeded: |
Now that we support UDFs, we can implement builtin functions as "virtual
UDFs", that are defined in the builtins map.
The builtin appears to be about twice as fast with this method, which is
nice because it gets used a lot in ORM introspection queries.
Release note (performance improvement): improve the performance of
pg_table_is_visible
Epic: None
Co-authored-by: rafiss [email protected]