Skip to content

Dump Babelfish operator classes for numeric-int comparisons to suppor… #578

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

Conversation

sumitj824
Copy link
Contributor

Description

Since Postgres does not dump user-defined operator classes over built-in data
types, this commit makes changes to dump new operator classes added in babelfish
extension as part of the numeric operator family (PR).

These operator classes are essential for supporting index scans between int and
numeric types when the index is created on a numeric column. The change ensures
that the operator classes are properly preserved during pg_upgrade operations,
maintaining the index scan capabilities in the upgraded database.

Signed-off-by: Sumit Jaiswal [email protected]

Issues Resolved

Task: BABEL-5648

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 PostgreSQL license, 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.

@Deepesh125 Deepesh125 merged commit db5661f into babelfish-for-postgresql:BABEL_4_X_DEV__PG_16_X May 16, 2025
2 checks passed
Deepesh125 pushed a commit to babelfish-for-postgresql/babelfish_extensions that referenced this pull request May 16, 2025
Earlier, index scan would not be chosen by the optimizer when filtering between
int and numeric types if the index was created on a numeric column. While index
scans worked when the index was on an integer column (due to existing operator
class as part of int operator family), the reverse case wasn't supported.

This commit fixes this issue by adding a new operator class as part of the numeric
operator family which allows the optimizer to utilize indexes on numeric columns when
filtering with integer values, improving query performance in these scenarios.

This changes also requires engine changes (babelfish-for-postgresql/postgresql_modified_for_babelfish#578)
in order to dump these Babelfish defined operator class correctly during pg_upgrade.

Task: BABEL-5648
Signed-off-by: Sumit Jaiswal <[email protected]>
Mohitraj-g pushed a commit to Mohitraj-g/babelfish_extensions that referenced this pull request May 23, 2025
…elfish-for-postgresql#3764)

Earlier, index scan would not be chosen by the optimizer when filtering between
int and numeric types if the index was created on a numeric column. While index
scans worked when the index was on an integer column (due to existing operator
class as part of int operator family), the reverse case wasn't supported.

This commit fixes this issue by adding a new operator class as part of the numeric
operator family which allows the optimizer to utilize indexes on numeric columns when
filtering with integer values, improving query performance in these scenarios.

This changes also requires engine changes (babelfish-for-postgresql/postgresql_modified_for_babelfish#578)
in order to dump these Babelfish defined operator class correctly during pg_upgrade.

Task: BABEL-5648
Signed-off-by: Sumit Jaiswal <[email protected]>
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.

2 participants