From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Marti Raudsepp <marti(at)juffo(dot)org> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Enable min/max optimization for bool_and/bool_or/every |
Date: | 2012-02-08 17:48:20 |
Message-ID: | 28056.1328723300@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Marti Raudsepp <marti(at)juffo(dot)org> writes:
> On Thu, Dec 22, 2011 at 18:41, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Mon, Dec 19, 2011 at 5:16 AM, Marti Raudsepp <marti(at)juffo(dot)org> wrote:
>>> PS: It seems that the min/max optimization isn't documented in the
>>> manual (apart from release notes), so I didn't include any doc changes
>>> in this patch.
>> I don't see a patch attached to this email, so either you forgot to
>> attach it, or the list ate it somehow.
> I forgot to attach it, sorry. Here it is.
I applied this patch, since I was busy applying catalog changes from you
anyway ;-).
I did think of a possible reason to reject the patch: with this change,
the planner will take longer to plan queries involving bool_and() et al,
since planagg.c will spend time looking (usually fruitlessly) for an
index-based plan. I tried this simple test case:
create table t (f1 bool);
\timing
explain select bool_and(f1) from t;
Best-case timings for the EXPLAIN were about 0.480 ms without the patch
and 0.500 ms with, so about a 4% penalty. On more complicated queries
I think the fractional cost would be less. This seemed acceptable to
me, so I went ahead and applied the change, but if anyone wants to
argue about it now's the time.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-02-08 17:53:54 | Re: Text-any concatenation volatility acting as optimization barrier |
Previous Message | Andrew Dunstan | 2012-02-08 17:23:44 | Re: Text-any concatenation volatility acting as optimization barrier |