Re: appropriate sort_mem & shared buffers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: appropriate sort_mem & shared buffers
Дата
Msg-id 13426.1009818792@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: appropriate sort_mem & shared buffers  (Francisco Reyes <lists@natserv.com>)
Ответы Re: appropriate sort_mem & shared buffers  (Francisco Reyes <lists@natserv.com>)
Список pgsql-novice
Francisco Reyes <lists@natserv.com> writes:
>> But since you didn't
>> say how many concurrent backends you expect to run, this is all just
>> theorizing in the dark.

> What is the relation between number of connections and buffers?

You need to ensure you have enough RAM left over (after allocating the
buffers) for all the backends you want to run.  Don't forget that
sort_mem is per-backend, too.

My gut feeling is that a few thousand buffers (corresponding to a few
tens of megabytes of RAM) is the right range for production situations
on most modern machines.

As an example, yesterday I was running some tests of pgbench with scale
factor 50 and 64 clients, on a Linux box with 256MB RAM.  At -B 4096
I got about 40 transactions/sec; at -B 8192 I got about 55; at -B 16384
it dropped off to about 32 t/s.  vmstat showed considerable swapping
activity in the last case, so evidently I had run the machine out of RAM
by allocating too much to buffers.

> I was thinking that the higher the
> buffer size the longer it would take for the database to allocate the
> memory before it can serve the query.

No.  The shared buffers are a static allocation that is made once when
the postmaster starts.

            regards, tom lane

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

Предыдущее
От: Francisco Reyes
Дата:
Сообщение: Re: appropriate sort_mem & shared buffers
Следующее
От: Francisco Reyes
Дата:
Сообщение: Re: appropriate sort_mem & shared buffers