Re: Why SyncOneBuffer does not called frequently?

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: 高健 <luckyjackgao(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why SyncOneBuffer does not called frequently?
Date: 2012-10-31 15:50:33
Message-ID: CAMkU=1zstxGAfrLEcJcLD_Ls97qEghjnXrgvzQhTvFo3iWqSvg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 31, 2012 at 1:53 AM, 高健 <luckyjackgao(at)gmail(dot)com> wrote:
> Hi all:
>
> I am trying to understand when the bgwriter is written.
>
> I thought that the bgwriter.c's calling turn is:
>
> BackgroundWriterMain ->BgBufferSync-> SyncOneBuffer

SyncOneBuffer is called with skip_recently_used true, so the buffer
will not get written by the background writer if it is was recently
used.

>
> And In my postgresql.conf , the bgwriter_delay=200ms.
>
> I did the following:
>
> postgres=# select * from testtab;
> id | val
> ----+-------
> 1 | 12345
> (1 row)
>
> postgres=# update testtab set val='54321' where id=1;
> UPDATE 1
> postgres=# select * from testtab;
> id | val
> ----+-------
> 1 | 54321
> (1 row)
>
> postgres=#
>
> Now I can say the buffer is dirty ,right?

It is dirty, but it also has a positive usagecount.

Are you sure it is that SyncOneBuffer is not getting called, rather
than it is getting called but returning before doing the write?

Cheers,

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christian Hammers 2012-10-31 16:21:31 When do archived WAL files gets removed after wal_keep_segments changed?
Previous Message Moshe Jacobson 2012-10-31 15:31:06 Re: Parallel Insert and Delete operation