-
Notifications
You must be signed in to change notification settings - Fork 2
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
Make sorting of the *-bucket consistent and controllable #439
Comments
Unfortunately, when trying (3.) manually, I ran into more problems, where the *-bucket was missorted, likely due to an
As you can see above, the *-bucket row doesn't observe the requested sorting. The
|
Can we use get_relation_stats hook to give the column a distribution that does not trigger that plan path? |
This sounds a little complex and might have some unexpected side-effects - judging just after throwing a first glance. Let's keep it as another possible solution. Also: |
The spot taken by the *-bucket row in the results of a query can vary from query to query (and sometimes for the same query issued before or after
ANALYZE;
!).In a nutshell, the
Sort
plan node may or may not be pushed down by the planner, to a spot before theAgg
/BucketScan
nodes. If it is then theORDER BY
sorting will not impact it, meaning it will come first. In other circumstances, if theSort
node comes last, it is impacted byORDER BY
.Example query where it didn't get pushed down:
And where it did (because
id
has many unique columns perANALYZE;
, and theHashAggregate
has been changed toSort -> GroupAggregate
:Ideas from slack thread:
prependAppend anORDER BY is_suppress_bin(*)
and let the planner figure it outThe text was updated successfully, but these errors were encountered: