Greg Smith <gsmith@gregsmith.com> wrote:
> > In my understanding, each backend pins two or so buffers at once. So
> > percentage of pinned buffers should be low.
>
> With the pgbench workload, a substantial percentage of the buffer cache
> ends up pinned.
> http://westnet.com/~gsmith/content/postgresql/new-patch-checkpoint.txt
> bgwriter scan all writes=16.6 MB (69.3%) pinned=11.7 MB (48.8%) LRU=7.7 MB (31.9%)
> ...
> checkpoint required (wrote checkpoint_segments)
> checkpoint buffers dirty=19.4 MB (80.8%) write=188.9 ms sync=4918.1 ms
>
> Here 69% of the buffer cache contained dirty data, and 49% of the cache
> was both pinned and dirty.
No. "Pinned" means bufHdr->refcount > 0 and you don't distinguish pinned or
recently-used (bufHdr->usage_count > 0) buffers in your patch.
! if (bufHdr->refcount != 0 || bufHdr->usage_count != 0) {
! if (skip_pinned)
! {
! UnlockBufHdr(bufHdr);
! return BUF_PINNED;
! }
! buffer_write_type=BUF_WRITTEN_AND_PINNED;
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center