builtins: implement pg_table_is_visible as UDF#94339
builtins: implement pg_table_is_visible as UDF#94339craig[bot] merged 3 commits intocockroachdb:masterfrom
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 |
mgartner
left a comment
There was a problem hiding this comment.
Seems valid to me. Perhaps inefficiencies in the internal executor explain the speed up from this change?
cb153a4 to
d29ac16
Compare
rafiss
left a comment
There was a problem hiding this comment.
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
rafiss
left a comment
There was a problem hiding this comment.
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
jordanlewis
left a comment
There was a problem hiding this comment.
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
rafiss
left a comment
There was a problem hiding this comment.
lgtm!
Reviewable status:
complete! 0 of 0 LGTMs obtained
| // Dropped implements the Descriptor interface. | ||
| func (v TableImplicitRecordType) Dropped() bool { | ||
| v.panicNotSupported("Dropped") | ||
| return false |
There was a problem hiding this comment.
Shouldn't this instead delegate to the wrapped table descriptor?
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 <rafi@cockroachlabs.com>
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 rafi@cockroachlabs.com