Re: Shared Buffer Size

Поиск
Список
Период
Сортировка
От Greg Smith
Тема Re: Shared Buffer Size
Дата
Msg-id 4DE1AB70.2060601@2ndQuadrant.com
обсуждение исходный текст
Ответ на Re: Shared Buffer Size  (preetika tyagi <preetikatyagi@gmail.com>)
Список pgsql-general
On 05/27/2011 05:33 PM, preetika tyagi wrote:
> Hows does the shared buffer in Postgres rely on the Operating System
> cache?
> Suppose my RAM is 8 GB and shared_buffer is 24 MB in postgres. And
> there are some dirty pages in shared_buffer and I need to write a
> dirty page back to the disk to bring in a new page. What happens in
> this case? The dirty page will be written to the disk considering the
> shared_buffer size as 24 MB? or it will not be written and will stay
> in RAM which is 8 GB?
>

In this case, the dirty page will be written to the operating system,
which will initially store it in its own write cache.  Eventually the
operating system will write that page out to disk from that cache.  The
delay before that happens can easily be 30 seconds or more on operating
systems like Linux.  If PostgreSQL needs to read that data again, it may
find it still in the OS cache, in which case the read will happen very
quickly.  Eventually, the dirty data will be written to disk, and if
it's not used for long enough the OS cache memory will be re-used for
something else.

When you read a page into the database, and you don't dirty it, it might
be evicted from the database cache without a write.  If the database
needs that page again, it will ask the OS for it.  If the OS still has
it in its own read cache, it may just read it from the cache again,
without a real disk read happening.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books


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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: Shared Buffer Size
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: How to check a table content efficiently? With LIMIT and OFFSET?