From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
---|---|
To: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> |
Cc: | Kiriakos Georgiou <kg(dot)postgresql(at)olympiakos(dot)com>, Alexis Woo <awoo2611(at)gmail(dot)com>, "Psql_General (E-mail)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Avoid sorting when doing an array_agg |
Date: | 2016-12-04 22:12:06 |
Message-ID: | CAH2-Wz=2fLpKNKkUUda4Od0k4bGzoeHZOLNSWzjp4v9VsCk74w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, Dec 3, 2016 at 5:20 PM, Tomas Vondra
<tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
> So the sort is probably slow because of CPU, as it compares strings. In
> some locales that may be very expensive - not sure which locale is used
> in this case, as it was not mentioned.
I wonder what it would take to teach the optimizer to consider the
possibility of a "collation strength reduction". In other words, for
aggregates that perform a sort (or for aggregates that rely on the
presence of a sort node without there being some other dependency on
the sort node), it should be possible for the optimizer to determine
that it would be just fine to use the C locale, since the user isn't
entitled to assume anything about the exact sort order. There are of
course cases where this can make a huge difference.
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2016-12-04 22:22:39 | Re: Avoid sorting when doing an array_agg |
Previous Message | Paul Ramsey | 2016-12-04 21:24:07 | Re: Extensions and privileges in public schema |