Re: intelligence in writing a query ... - Mailing list pgsql-hackers

From Don Baccus
Subject Re: intelligence in writing a query ...
Date
Msg-id 3.0.1.32.20010530155336.016deb20@mail.pacifier.com
Whole thread Raw
In response to Re: intelligence in writing a query ...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
At 05:35 PM 5/30/01 -0400, Tom Lane wrote:

>Also, since status.gid is (I assume) unique, what's the use of the
>DISTINCT clause at the top level?  Seems like that's costing you
>a useless sort & unique pass ...

>> 2EXPLAIN SELECT distinct s.gid, s.created, count(i.title) AS images
...
>>           GROUP BY s.gid,s.created

He's already paying for a sort due to the GROUP BY but of course that
makes the DISTINCT meaningless since s.gid and s.created are already
grouped...



- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Support for %TYPE in CREATE FUNCTION
Next
From: Don Baccus
Date:
Subject: Re: Support for %TYPE in CREATE FUNCTION