ROX-28253: Change run query for schema#14939
Conversation
Reviewer's Guide by SourceryThis PR refactors Postgres query handling to use cursors only when necessary, specifically when the query pagination limit is not set or exceeds the cursor batch size. It introduces a new function Updated class diagram for cursorSessionclassDiagram
class cursorSession {
-id string
-tx *postgres.Tx
-close func()
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Images are ready for the commit at 37461f4. To use with deploy scripts, first |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14939 +/- ##
==========================================
- Coverage 48.96% 48.95% -0.02%
==========================================
Files 2550 2551 +1
Lines 187228 187411 +183
==========================================
+ Hits 91677 91747 +70
- Misses 88301 88404 +103
- Partials 7250 7260 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
18262f3 to
7008d28
Compare
|
How did you test this? I'm not sure CI is sufficient as I would imagine by and large the CI queries and flows would come in under the cursor threshold. I would think a new unit test would probably be valid as well since we are creating a new path. |
7008d28 to
37461f4
Compare
|
@dashrews78 I have changed functions. Based on @janisz tests, using a cursor is expensive, and we don't want to keep it everywhere. I didn't add a test because there is no @janisz, can you please check this PR again? |
I will be honest, these changes have been on blast and I have not had the time to keep up due to critical feature priority. So forgive me if the questions I'm about to ask have been addressed elsewhere. Regarding the "cursor is expensive" statement, there are 2 sides to that equation. Central expense and Postgres expense. Have we looked at how these changes impact consumption of resources on Postgres? Do we have quantification of the cursor expense some place? What type of load have these tests been performed? What set of objects and queries were primarily used? |
|
From my tests on alerts, cursor is 20 to 30% slower than without it. |
I think we are not getting it worse as we keep |
For posterity, I just want to point out that I don't think any of that actually answered my questions. |
Description
This PR has added some refactoring for Postgres query handling and introduces logic that will apply cursors in cases where that is needed.
This is related to changes made in #14636 <- that PR will be modified to use new function.
User-facing documentation
Testing and quality
Automated testing
How I validated my change
Summary by Sourcery
Refactor Postgres query handling to optimize cursor usage and improve query execution logic
Enhancements:
Chores: