From: | Florian Pflug <fgp(at)phlo(dot)org> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Greg Stark <stark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Negative Transition Aggregate Functions (WIP) |
Date: | 2014-01-20 02:40:37 |
Message-ID: | B24844FC-C553-490B-9870-667C752F520E@phlo.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Jan19, 2014, at 20:00 , David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> I've applied that patch again and put in the sort operators.
I've push a new version to https://github.com/fgp/postgres/tree/invtrans
This branch includes the following changes
* A bunch of missing declaration for *_inv functions
* An assert that the frame end doesn't move backwards - I realized that
it is after all easy to do that, if it's done after the loop which adds
the new values, not before.
* EXPLAIN VERBOSE ANALYZE now shows the max. number of forward aggregate
transitions per row and aggregate. It's a bit imprecise, because it doesn't
track the count per aggregate, but it's still a good metric for how well
the inverse transition functions work. If the number is close to one, you
know that very few rescans are happening.
* I've also renamed INVFUNC to INVSFUNC. That's a pretty invasive change, and
it's the last commit, so if you object to that, then you can merge up to
eafa72330f23f7c970019156fcc26b18dd55be27 instead of
de3d9148be9732c4870b76af96c309eaf1d613d7.
A few more things I noticed, all minor stuff
* do_numeric_discard()'s inverseTransValid flag is unnecessary. First, if the
inverse transition function returns NULL once, we never call it again, so the
flag won't have any practical effect. And second, assume we ever called the
forward transition function after the inverse fail, and then retried the inverse.
In the case of do_numeric_discard(), that actually *could* allow the inverse
to suddenly succeed - if the call to the forward function increased the dscale
beyond that of the element we tried to remove, removal would suddenly be
possible again. We never do that, of course, and it seems unlikely we ever
will. But it's still weird to have code which serves no other purpose than to
pessimize a case which would otherwise just work fine.
* The state == NULL checks in all the strict inverse transition functions are
redundant.
I haven't taken a close look at the documentation yet, I hope to be able to
do that tomorrow. Otherwise, things look good as far as I'm concerned.
best regards,
Florian Pflug
From | Date | Subject | |
---|---|---|---|
Next Message | Rami Grossman | 2014-01-20 03:31:00 | Hstore 2.0 patch |
Previous Message | Craig Ringer | 2014-01-20 02:33:14 | Re: ALTER TABLE ... SET TABLESPACE pg_default |