Skip site navigation (1) Skip section navigation (2)

Re: Shared Memory Sizing

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Curt Sampson <cjs(at)cynic(dot)net>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Shared Memory Sizing
Date: 2002-06-28 18:45:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Curt Sampson wrote:
> Certainly. But overall, you will cache a smaller number of blocks
> because you will be buffering them twice. When you copy a block
> from the OS buffer to shared memory, the copy still exists in the
> OS buffer. So that block is now buffered twice.

You have the block in the kernel buffer when you copy it to the
PostgreSQL buffers, but nothing says you have to keep that block in the
kernel buffers while PostgreSQL has it.  Only when it is written does it
return to the kernel, and if it is only read, it never returns to the

> For most workloads, in the long run, that will force you to do disk
> I/O that you would not have had to do otherwise. A single disk I/O
> is far more expensive than hundreds of copies between the OS buffer
> cache and postgres' shared memory.

Yes, if you swap, you went too far.  That has always been the upper

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to


pgsql-general by date

Next:From: Gregory SeidmanDate: 2002-06-28 18:50:46
Subject: Re: serial columns & loads misfeature?
Previous:From: Kevin BrannenDate: 2002-06-28 18:28:20
Subject: serial columns & loads misfeature?

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group