Re: How slow is distinct - 2nd

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: How slow is distinct - 2nd
Дата
Msg-id 20021004153108.GA14180@wolff.to
обсуждение исходный текст
Ответ на How slow is distinct - 2nd  ("Michael Contzen" <Michael.Contzen@dohle.com>)
Список pgsql-sql
On Tue, Oct 01, 2002 at 14:18:50 +0200, Michael Contzen <Michael.Contzen@dohle.com> wrote:
> Here the table:
> 
> mc=# \d egal
>      Table "public.egal"
>  Column |  Type   | Modifiers 
> --------+---------+-----------
>  i      | integer | 
> 
> mc=# select count(*) from egal;
>   count  
> ---------
>  7227744
> (1 row)
> 
> mc=# select count(distinct i) from egal;
>  count 
> -------
>     67
> (1 row)

This suggests that the best way to do this is with a hash instead of a sort.

If you have lots of memory you might try increasing the sort memory size.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: How slow is distinct - 2nd
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: rows in order