Re: GROUP BY Vs. Sub SELECT

Поиск
Список
Период
Сортировка
От Bruno Almeida do Lago
Тема Re: GROUP BY Vs. Sub SELECT
Дата
Msg-id 444ce266.1ca74910.7370.ffffe386@mx.gmail.com
обсуждение исходный текст
Ответ на Re: GROUP BY Vs. Sub SELECT  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: GROUP BY Vs. Sub SELECT  (Richard Broersma Jr <rabroersma@yahoo.com>)
Список pgsql-performance
OK! I totally understand what you said. I'll load this table with a
simulated data and see how PG deals with it.

About the queries being different, yes, I'm sure they are :-) I did not
mention that application is able to handle both.

I'd like to get more info on EXPLAIN ANALYZE output... where can I read more
about it?

Thank you very much for your attention!!

Regards,
Bruno


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Sunday, April 23, 2006 8:34 PM
To: Bruno Almeida do Lago
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] GROUP BY Vs. Sub SELECT

"Bruno Almeida do Lago" <teolupus@gmail.com> writes:
> I'm just getting familiar with EXPLAIN ANALYZE output, so I'd like to get
> some help to identify which one of the following queries would be better:

Well, you're breaking one of the first laws of PG performance analysis,
which is to not try to extrapolate the behavior on large tables from the
behavior on toy tables.  You can't really see where the bottlenecks are
on a toy example, and what's more there's no reason to think that the
planner will use the same plan when presented with much larger tables.
So you need to load up a meaningful amount of data (don't forget to
ANALYZE afterward!) and then see what it does.

> I think 2nd would be better, since when database grow up the GROUP BY may
> become too costly. Is that right?

The two queries don't give the same answer, so asking which is faster
is a bit irrelevant.  (When there's more than one group, wouldn't the
per-group MAXes be different?)

            regards, tom lane


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

Предыдущее
От: "Paul Mackay"
Дата:
Сообщение: Index on function less well cached than "regular" index ?
Следующее
От: Alex Hayward
Дата:
Сообщение: Re: Hardware: HP StorageWorks MSA 1500