Re: Sort performance on large tables

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Sort performance on large tables
Дата
Msg-id 437088A1.8090304@archonet.com
обсуждение исходный текст
Ответ на Sort performance on large tables  (Charlie Savage <cfis@interserv.com>)
Ответы Re: Sort performance on large tables  (Charlie Savage <cfis@interserv.com>)
Список pgsql-performance
Charlie Savage wrote:
> Hi everyone,
>
> I have a question about the performance of sort.

> Note it takes over 10 times longer to do the sort than the full
> sequential scan.
>
> Should I expect results like this?  I realize that the computer is quite
> low-end and is very IO bound for this query, but I'm still surprised
> that the sort operation takes so long.

The sort will be spilling to disk, which will grind your I/O to a halt.

> work_mem =  16384                        # in Kb

Try upping this. You should be able to issue "set work_mem = 100000"
before running your query IIRC. That should let PG do its sorting in
larger chunks.

Also, if your most common access pattern is ordered via tlid look into
clustering the table on that.
--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Charlie Savage
Дата:
Сообщение: Sort performance on large tables
Следующее
От: Mario Weilguni
Дата:
Сообщение: Re: 8.1 iss