Re: big distinct clause vs. group by

Поиск
Список
Период
Сортировка
От Robert Klemme
Тема Re: big distinct clause vs. group by
Дата
Msg-id BANLkTindpLiBP7faprcJvUVC=2zE7ZDJBg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: big distinct clause vs. group by  (Uwe Bartels <uwe.bartels@gmail.com>)
Ответы Re: big distinct clause vs. group by  (Claudio Freire <klaussfreire@gmail.com>)
Список pgsql-performance
On Tue, Apr 19, 2011 at 10:47 AM, Uwe Bartels <uwe.bartels@gmail.com> wrote:
> Oh, I do care about these columns.
> But by using an group by on the key columns, I cannot select the columns as
> they are. Otherwise you get an error message.
> So I have to use an aggregate functionlike min().

I find that slightly contradictory: either you do care about the
values then your business requirements dictate the aggregate function.
 If you only want to pick any value actually in the table but do not
care about which one (e.g. MIN or MAX or any other) then you don't
actually care about the value.  Because "SELECT a, MAX(b) ... GROUP BY
a" and "SELECT a, MIN(b) ... GROUP BY a" are not equivalent.  And, if
you do not care then there is probably no point in selecting them at
all.  At best you could use a constant for any legal value then.

Cheers

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

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

Предыдущее
От: Robert Klemme
Дата:
Сообщение: Re: How to configure a read-only database server?
Следующее
От: Laurent Laborde
Дата:
Сообщение: postgresql random io test with 2 SSD Kingston V+100 500GB in (software) Raid1