Re: Logical Aggregate Functions (eg ANY()) - Mailing list pgsql-general

From Robert James
Subject Re: Logical Aggregate Functions (eg ANY())
Date
Msg-id CAGYyBgie=9a3JaM9tYORVYhtwybW_Er+v+B+fY2Bof377xgkvQ@mail.gmail.com
Whole thread Raw
In response to Re: Logical Aggregate Functions (eg ANY())  (Marti Raudsepp <marti@juffo.org>)
Responses Re: Logical Aggregate Functions (eg ANY())
List pgsql-general
On 12/15/11, Marti Raudsepp <marti@juffo.org> wrote:
> On Thu, Dec 15, 2011 at 18:10, Robert James <srobertjames@gmail.com> wrote:
>> How do I do the equivalent of an ANY() or ALL() in PG Aggregate SQL?
>
> Note that in many cases, writing an EXISTS(SELECT ...) or NOT
> EXISTS(...) subquery is faster, since the planner can often optimize
> those to a single index access -- whereas an aggregate function would
> necessarily need to walk through and evaluate all potential rows.
>

Really? The planner can't tell that, for instance, BOOL_AND (false, *)
is automatically false?

(BTW Thanks for the great responses everyone! On this and other posts
on this list)

pgsql-general by date:

Previous
From: Robert James
Date:
Subject: Re: CREATE OR REPLACE AGGREGATE
Next
From: Chris Angelico
Date:
Subject: Performance question: Commit or rollback?