Re: pgbench -i spends all its time doing CHECKPOINT - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: pgbench -i spends all its time doing CHECKPOINT
Date
Msg-id 200201061947.g06Jl4K02188@candle.pha.pa.us
Whole thread Raw
In response to Re: pgbench -i spends all its time doing CHECKPOINT  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > question is if we do a big transaction that needs 10 log segments, do we
> > force an early CHECKPOINT to clear out the WAL segments or do we just
> > wait for the proper interval?
> 
> A checkpoint is forced after every CHECKPOINT_SEGMENTS log segments,
> regardless of longevity of transactions.  See
> http://developer.postgresql.org/docs/postgres/wal-configuration.html
> 
> Since segments before the checkpoint-before-last are deleted or recycled
> after each checkpoint, the maximum number of back segments would
> normally be 2 * CHECKPOINT_SEGMENTS.  We also pre-create WAL_FILES
> future log segments.  Counting the current segment gives a total of
> WAL_FILES + 2 * CHECKPOINT_SEGMENTS + 1 log segments.
> 
> AFAICS, the only way to force the current code into creating more than
> WAL_FILES + 2 * CHECKPOINT_SEGMENTS + 1 log segments is to be generating
> WAL entries at such a high rate that more than WAL_FILES log segments
> are filled before a triggered checkpoint can be completed.
> 

Very interesting.  Thanks.  Is there a reason someone would manually run
the CHECKPOINT command?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Spinning verses sleeping in s_lock
Next
From: mlw
Date:
Subject: Re: Spinning verses sleeping in s_lock