Re: intelligence in writing a query ...

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, The Hermit Hacker <scrappy(at)hub(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org, tech-fyi(at)hub(dot)org
Subject: Re: intelligence in writing a query ...
Date: 2001-05-30 22:53:36
Message-ID: 3.0.1.32.20010530155336.016deb20@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 2001-05-30 22:56:35 Re: Support for %TYPE in CREATE FUNCTION
Previous Message Bruce Momjian 2001-05-30 22:01:59 Re: Support for %TYPE in CREATE FUNCTION