Re: sub-select with aggregate - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: sub-select with aggregate
Date
Msg-id 20021023085544.S5843-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: sub-select with aggregate  ("Tomasz Myrta" <jasiek@klaster.net>)
List pgsql-sql
On Wed, 23 Oct 2002, Tomasz Myrta wrote:

> > On Wed, 23 Oct 2002, Tomasz Myrta wrote:
> >
> > > Uz.ytkownik Stephan Szabo napisa?:
> > Without group_id in the select list you couldn't do a where
> > group_id = <something> if the select was a view.
> I know - it was just example of query.
>
> > Did you see the other two queries I gave?  On 7.3, both of those queries
> > appear (according to explain output) to do the limiting of group_id
> > inside the subquery rather than doing the subquery with all rows.
> > The explanation above was why I believe it was different from your
> > original query.
> I saw them. So should I wait for 7.3? Currently I have 7.2 and my work
> stopped because of this.

IIRC 7.2's explain doesn't show which clauses are on which plans (it'll
show that it's doing an index scan or whatever, but not what it's actually
looking for.  The query probably optimizes similarly though.  I'd suggest
trying it and seeing if it runs any better.  I'm also assuming you have
an index on group_id to prevent the sequential scan of users.




pgsql-sql by date:

Previous
From: "Tomasz Myrta"
Date:
Subject: Re: sub-select with aggregate
Next
From: "Josh Berkus"
Date:
Subject: Re: Multiple Databases