Re: performance for MIN,MAX aggregates

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: performance for MIN,MAX aggregates
Дата
Msg-id 20030311113855.GA2334@wolff.to
обсуждение исходный текст
Ответ на performance for MIN,MAX aggregates  (Ruslan A Dautkhanov <rusland@scn.ru>)
Список pgsql-bugs
On Tue, Mar 11, 2003 at 15:42:41 +0700,
  Ruslan A Dautkhanov <rusland@scn.ru> wrote:
> Hello all,
>
> Just a little simple example:
>
>         isbs=# \d radauth
>                        Table "public.radauth"
>           Column  |            Type             | Modifiers
>         ----------+-----------------------------+-----------
>          dttm     | timestamp(0) with time zone |
>          username | text                        |
>          realm    | text                        |
>          logline  | text                        |
>         Indexes: radauth_dttm_username btree (dttm, username)
>
>         isbs=# explain select min(dttm) from radauth;
>                                      QUERY PLAN
>         --------------------------------------------------------------------
>          Aggregate  (cost=2591.75..2591.75 rows=1 width=8)
>            ->  Seq Scan on radauth  (cost=0.00..2363.00 rows=91500 width=8)
>         (2 rows)

This is discussed a lot in the archives. The short answer is use the
following query instead:
select dttm from radauth order by dttm limit 1;

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

Предыдущее
От: Ruslan A Dautkhanov
Дата:
Сообщение: performance for MIN,MAX aggregates
Следующее
От: Josh Berkus
Дата:
Сообщение: Aliased SubSelect in HAVING clause bug -- in progress?