Re: intelligence in writing a query ...

Поиск
Список
Период
Сортировка
От Don Baccus
Тема Re: intelligence in writing a query ...
Дата
Msg-id 3.0.1.32.20010530155336.016deb20@mail.pacifier.com
обсуждение исходный текст
Ответ на Re: intelligence in writing a query ...  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Support for %TYPE in CREATE FUNCTION
Следующее
От: Don Baccus
Дата:
Сообщение: Re: Support for %TYPE in CREATE FUNCTION