Re: Ordering behavior for aggregates - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Ordering behavior for aggregates
Date
Msg-id CAKFQuwZ0yx81sXNWzW6GHEX+nFzjgX_w8jLExxF9u+uxZfJp1w@mail.gmail.com
Whole thread Raw
In response to Re: Ordering behavior for aggregates  (Ronan Dunklau <ronan.dunklau@aiven.io>)
Responses Re: Ordering behavior for aggregates
List pgsql-hackers
On Tue, Dec 13, 2022 at 9:45 AM Ronan Dunklau <ronan.dunklau@aiven.io> wrote:
Le mardi 13 décembre 2022, 16:13:34 CET Tom Lane a écrit :
> Accordingly, I find nothing at all attractive in this proposal.
> I think the main thing it'd accomplish is to drive users back to
> the bad old days of ordering-by-subquery, if they have a requirement
> we failed to account for.

I think the ability to mark certain aggregates as being able to completely
ignore the ordering because they produce exactly the same results is still a
useful optimization.


I seriously doubt that users are adding unnecessary ORDER BY clauses to their aggregates. The more compelling use case would be existing ORMs that produce such problematic SQL - are there any though?

I'm more keen on the idea of having the system understand when an ORDER BY is missing - that seems like what users are more likely to actually do.  But it doesn't seem all that useful given the lack of aggregates that would actually use it meaningfully.

David J.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Ordering behavior for aggregates
Next
From: Peter Geoghegan
Date:
Subject: Re: New strategies for freezing, advancing relfrozenxid early