Counting Distinct Records

Поиск
Список
Период
Сортировка
Искать
От
Thomas F.O'Connell
Тема
Counting Distinct Records
Дата
Msg-id
1B2F7B00-3808-11D9-95C2-000D93AE0944@sitening.com
Список
Дерево обсуждения
Counting Distinct Records Thomas F.O'Connell <tfo@sitening.com>
Re: Counting Distinct Records Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: Counting Distinct Records Thomas F.O'Connell <tfo@sitening.com>
Re: Counting Distinct Records Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: Counting Distinct Records Thomas F.O'Connell <tfo@sitening.com>
Re: Counting Distinct Records Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: Counting Distinct Records Thomas F.O'Connell <tfo@sitening.com>
I am wondering whether the following two forms of SELECT statements are 
logically equivalent:

SELECT COUNT( DISTINCT table.column ) ...

and

SELECT DISTINCT COUNT( * ) ...

If they are the same, then why is the latter query much slower in 
postgres when applied to the same FROM and WHERE clauses?

Furthermore, is there a better way of performing this sort of operation 
in postgres (or just in SQL in general)?

Thanks!

-tfo

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005


В списке pgsql-sql по дате отправления
От: carex@skynet.be (carex)
Дата:
От: Stephan Szabo
Дата:
Сообщение: Re: Counting Distinct Records
FAQ