Re: Logical Aggregate Functions (eg ANY())

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: Robert James <srobertjames(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Logical Aggregate Functions (eg ANY())
Date: 2011-12-15 19:08:48
Message-ID: CABRT9RBN_LabYc+GGBD=3uCZPz70SyuiMHk2iDd0mG_vayiLYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Dec 15, 2011 at 18:10, Robert James <srobertjames(at)gmail(dot)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.

Regards,
Marti

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Angelico 2011-12-15 20:25:53 Re: Philosophical question
Previous Message Scott Marlowe 2011-12-15 19:01:26 Re: LOCK DATABASE