-
Notifications
You must be signed in to change notification settings - Fork 14
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
DM-49296: Set SQLite constant_rows_max, and use it in join_data_coordinates. #1164
Conversation
With QG generation now relying heavily on join_data_coordinates, we were hitting this limit sometimes.
4afe366
to
e717104
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #1164 +/- ##
=======================================
Coverage 89.36% 89.36%
=======================================
Files 367 367
Lines 49546 49548 +2
Branches 6016 6016
=======================================
+ Hits 44275 44277 +2
Misses 3852 3852
Partials 1419 1419 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK, one question.
def get_constant_rows_max(self) -> int: | ||
# Docstring inherited. | ||
# This is the default SQLITE_MAX_COMPOUND_SELECT (see | ||
# https://www.sqlite.org/limits.html): | ||
return 500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default one (in Database
) is 100, does it mean Postgres limit is lower than SQLite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no limit for this specifically listed on the PostgreSQL limits doc page, so I suspect the de facto PostgreSQL limit one on total SELECT statement size or number of bind parameters. Keeping the limit really low here means we make temporary tables more often, which might be less efficient than we could be, but it guards pretty effectively against blowing one of those limits with really wide rows.
Or, in other words, "I don't think we know what we should set it to, but performance is okay with this."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just surprised that you are reducing DirectQueryDriver._constant_rows_limit
to 500 for SQLite and to 100 for Postgres. Before this change it was 1000 for both. My guess is that you hit 500 limit in SQLite tests, but does it also need much lower Postgres limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's a good point, when you put it that way, and all of my testing with PostgreSQL was with the 1000-row limit before I made this change. I think I will go change the default to that, as I think that's still plenty conservative enough.
With QG generation now relying heavily on join_data_coordinates, we were hitting this limit sometimes.
Checklist
doc/changes
configs/old_dimensions