Re: HAVING push-down

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: HAVING push-down
Date: 2007-01-26 15:46:59
Message-ID: 45BA2273.8000800@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs wrote:
> On Fri, 2007-01-26 at 15:22 +0000, Gregory Stark wrote:
>> "Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:
>>
>>> I've just read a paper that says PostgreSQL doesn't do this. My reading
>>> of the code is that we *do* evaluate the HAVING clause prior to
>>> calculating the aggregates for it. I thought I'd check to resolve the
>>> confusion.
>>>
>
>> You mean in cases like this?
>>
>> postgres=# explain select count(*) from customer group by c_w_id,c_d_id,c_id having c_w_id = 1 and c_d_id=1 and c_id=1;
>> QUERY PLAN
>> ------------------------------------------------------------------------------------
>> GroupAggregate (cost=0.00..13.61 rows=1 width=12)
>> -> Index Scan using pk_customer on customer (cost=0.00..13.56 rows=4 width=12)
>> Index Cond: ((c_w_id = 1) AND (c_d_id = 1) AND (c_id = 1))
>> (3 rows)
>
> OK, thanks. I'll feedback to the author of the paper I was reviewing.
>

Care to share the paper in general? It might be beneficial for all of us.

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-01-26 15:49:18 Re: crash on 8.2 and cvshead - failed to add item to the
Previous Message Simon Riggs 2007-01-26 15:39:59 Re: Implied Functional index use (redux)