Skip to content

Replacing sys.is_table_type SQL function with C implementation#4852

Open
RuchaSK1 wants to merge 2 commits into
babelfish-for-postgresql:BABEL_6_X_DEVfrom
amazon-aurora:jira-babel-6458-part4
Open

Replacing sys.is_table_type SQL function with C implementation#4852
RuchaSK1 wants to merge 2 commits into
babelfish-for-postgresql:BABEL_6_X_DEVfrom
amazon-aurora:jira-babel-6458-part4

Conversation

@RuchaSK1

@RuchaSK1 RuchaSK1 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Description

The SQL-based is_table_type() joins pg_type and pg_depend catalogs on every call. Replace with a C function using SysCache hash lookups and a narrow pg_depend probe, reducing per-call cost from milliseconds to microseconds.

Update sys.table_types_internal view to drop the pg_depend join and use the C function directly. This benefits sys.objects, sys.all_objects, and sys.tables which all depend on table_types_internal.

Issues Resolved

[List any issues this PR will resolve]

Test Scenarios Covered

  • Use case based -

  • Boundary conditions -

  • Arbitrary inputs -

  • Negative test cases -

  • Minor version upgrade tests -

  • Major version upgrade tests -

  • Performance tests -

  • Tooling impact -

  • Client tests -

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Rucha Kulkarni added 2 commits June 4, 2026 10:18
Signed-off-by: Rucha Kulkarni <ruchask@amazon.com>
Signed-off-by: Rucha Kulkarni <ruchask@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant