Skip to content
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

Improve performance of sp_describe_undeclared_parameters #2049

Conversation

ahmed-shameem
Copy link
Contributor

Description

sp_describe_undeclared_parameters is slow. The issue is reported here: #1317.

Initially, we used to create a query in C for every parameter passed as an argument to sp_describe_undeclared_parameters and then execute it. This was taking huge amount of time as it used JOINS among multiple views like sys.objects, sys.columns, sys.types T. In this commit, we have replaced the use of such views as much as possible with pg catalogs. This aids to the improvement in performance.

The changes are tested locally.

Performance improvements (All the times are in ms):
-------------- INSERT --------------

No of Params Before After
1 3796 281
2 6774 44
8 27648 1323
10 35425 1363
20 70130 1844
30 106210 1937
40 141363 2712
50 179453 2940
60 223271 4861
70 257286 6499
80 298696 8966
90 344058 10309
100 385037 12815

-------------- UPDATE --------------

No of Params Before After
1 7024 133
2 10389 64
8 31522 1283
10 39633 1314
20 73458 1710
30 109540 1927
40 144949 2762
50 184793 2940
60 227304 5151
70 259366 6398
80 302109 9135
90 345392 10677
100 387352 12857

-------------- DELETE --------------

No of Params Before After
1 3519 64
2 6975 45
8 27997 1282
10 34696 1350
20 70144 1727
30 105511 1933
40 144679 2701
50 180619 2955
60 224197 4864
70 260444 6457
80 305708 8955
90 350545 10393
100 391443 12878

Task: BABEL-3705
Signed-off-by: Shameem Ahmed [email protected]

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.

ahmed-shameem and others added 3 commits November 21, 2023 14:45
…or-postgresql#2040)

sp_describe_undeclared_parameters is slow. The issue is reported here: babelfish-for-postgresql#1317 

Initially, we used to create a query in C for every parameter passed as an argument to
sp_describe_undeclared_parameters and then execute it. This was taking huge amount of time as it used JOINS among
multiple views like sys.objects, sys.columns, sys.types T. In this commit, we have replaced the use of such views as
much as possible with pg catalogs. This aids to the improvement in performance.

Task: BABEL-3705
Signed-off-by: Shameem Ahmed <[email protected]>
@shardgupta shardgupta merged commit 91dac8b into babelfish-for-postgresql:BABEL_2_7_STABLE Nov 22, 2023
23 checks passed
@shardgupta shardgupta deleted the jira-babel-3705-2-7-stable branch November 22, 2023 06:58
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