From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Tomasz Myrta <jasiek@klaster.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: sub-select with aggregate
Date: Wed, 23 Oct 2002 08:57:47 -0700 (PDT)
Message-ID: <20021023085544.S5843-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <20021023174445.M37904@klaster.net>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone23.bigpanda.com, jasiek@klaster.net
Subject: Re: sub-select with aggregate
In-Reply-To: <20021023085544.S5843-100000@megazone23.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox