On Wed, Oct 31, 2012 at 1:53 AM, 高健 <luckyjackgao@xxxxxxxxx> 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general