Re: count (DISTINCT expression [ , ... ] ) and documentation

Поиск
Список
Период
Сортировка
Искать
От
Ivan Sergio Borgonovo
Тема
Re: count (DISTINCT expression [ , ... ] ) and documentation
Дата
Msg-id
20081226200330.35c5e191@dawn.webthatworks.it
Ответ на
Список
Дерево обсуждения
count (DISTINCT expression [ , ... ] ) and documentation Ivan Sergio Borgonovo <mail@webthatworks.it>
Re: count (DISTINCT expression [ , ... ] ) and documentation "Pavel Stehule" <pavel.stehule@gmail.com>
Re: count (DISTINCT expression [ , ... ] ) and documentation Ivan Sergio Borgonovo <mail@webthatworks.it>
Re: count (DISTINCT expression [ , ... ] ) and documentation "Pavel Stehule" <pavel.stehule@gmail.com>
Re: count (DISTINCT expression [ , ... ] ) and documentation Ivan Sergio Borgonovo <mail@webthatworks.it>
Re: count (DISTINCT expression [ , ... ] ) and documentation "Pavel Stehule" <pavel.stehule@gmail.com>
Re: count (DISTINCT expression [ , ... ] ) and documentation David Fetter <david@fetter.org>
Re: count (DISTINCT expression [ , ... ] ) and documentation Ivan Sergio Borgonovo <mail@webthatworks.it>
Re: count (DISTINCT expression [ , ... ] ) and documentation David Fetter <david@fetter.org>
WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation Ivan Sergio Borgonovo <mail@webthatworks.it>
Re: WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation Tom Lane <tgl@sss.pgh.pa.us>
Re: WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation David Fetter <david@fetter.org>
subselect and count (DISTINCT expression [ , ... ] ) performances Ivan Sergio Borgonovo <mail@webthatworks.it>
On Fri, 26 Dec 2008 10:43:25 -0800
David Fetter  wrote:

> On Fri, Dec 26, 2008 at 03:34:33PM +0100, Ivan Sergio Borgonovo
> wrote:
> > I noticed that starting from 8.2 the documentation at
> > http://www.postgresql.org/docs/8.2/interactive/sql-expressions.html
> > say that multiple distinct expressions are supported
> > 
> > aggregate_name (DISTINCT expression [, expression] )

> In 8.4, you'll be able to do:

> WITH d AS (
>     SELECT DISTINCT c1, c2 FROM table1
> )
> SELECT count(*) FROM d;

Nice, but what will be the difference from
select count(*) from (select distinct c1, c2 from t);
?
Optimisation?

Furthermore... I was actually looking at docs because I needed to
find a way supported by both postgresql and mysql and I've heard
that mysql is not that good at subselect and I doubt it supports
WITH AS. (OK not really a postgresql problem...).

Meanwhile what would you suggest as a general approach to stuff like

select count(distinct c1, c2) from t;

regardless of mysql support?
and considering mysql support?

I was thinking to find some way to exploit group by, but I didn't
come to anything useful yet.

> and very likely an OLAP version. :)

What's "an OLAP version" of WITH d AS...

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it

В списке pgsql-general по дате отправления
От: Pavel Stehule
Дата:
От: David Fetter
Дата:
FAQ