Re: WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation
Дата
Msg-id 20081227071043.GC3793@fetter.org
обсуждение исходный текст
Ответ на Re: WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Fri, Dec 26, 2008 at 07:13:48PM -0500, Tom Lane wrote:
> Ivan Sergio Borgonovo <mail@webthatworks.it> writes:
> >>> David Fetter <david@fetter.org> wrote:
> >>>> 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?
>
> >> None especially.
>
> > So what would be the advantage compared to subselect?
>
> None, David just has WITH on the brain ;-)

LOL!

You're only saying that because it's true ;)

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

В списке pgsql-general по дате отправления:

Предыдущее
От: J Ottery
Дата:
Сообщение: Bind message has 6 results formats but query has 5 columns
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: "disappearing" rows in temp table, in recursing trigger