From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sebastian P. Luque <spluque@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@postgresql.org
Subject: Re: custom average window function failure
Date: Sun, 09 Oct 2016 16:00:21 -0400
Message-ID: <12651.1476043221@sss.pgh.pa.us> (raw)
In-Reply-To: <87eg3puxif.fsf@otaria.sebmel.org>
References: <87int2qkat.fsf@gmail.com>
<19183.1476027964@sss.pgh.pa.us>
<1156e81d-0903-f453-6751-347d5105d4ca@aklaver.com>
<4302.1476031209@sss.pgh.pa.us>
<87eg3puxif.fsf@otaria.sebmel.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
"Sebastian P. Luque" <spluque@gmail.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> On closer inspection, the error is only in the
>> aggregate-used-as-window-function case, not plain aggregation.
> Yes, I see the same phenomenon. Could someone suggest a workaround
> until this is fixed? I'm under the gun to submit output tables and the
> only thing I can think of is a crawling slow loop to step through each
> window twice: once using the plain aggregation and another without just
> get all rows. I highly doubt it will be worthwhile, given it's going to
> be about 1000 iterations, and each one would take about 30-45 min...
Are you in a position to apply patches? It's a one-line fix:
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=dca25c2562199ce1e7e26367613912a8e...
Alternatively, the problem doesn't manifest when the aggregate transtype
and output type are the same, so you could probably refactor your code
to use plain array_agg and apply the finalfunc separately in the SQL
query.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, spluque@gmail.com, adrian.klaver@aklaver.com
Subject: Re: custom average window function failure
In-Reply-To: <12651.1476043221@sss.pgh.pa.us>
References: <87int2qkat.fsf@gmail.com> <19183.1476027964@sss.pgh.pa.us> <1156e81d-0903-f453-6751-347d5105d4ca@aklaver.com> <4302.1476031209@sss.pgh.pa.us> <87eg3puxif.fsf@otaria.sebmel.org> <12651.1476043221@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox