On 04.01.2012 08:42, Amit Kapila wrote:
> Why PostgreSQL needs to write WAL record for Checkpoint when it maintains
> same information in pg_control file?
I guess it wouldn't be strictly necessary...
> This may be required in case we need information about more than one
> checkpoint as pg_control can hold information of only recent checkpoint. But
> I could not think of a case where more than one checkpoint information will
> be required.
There is a pointer in the control file to the previous checkpoint, too.
It's not normally needed, but we fall back to that if the latest
checkpoint cannot be read for some reason, like disk failure. If you
have a disk failure and cannot read the latest checkpoint, chances are
that you have a corrupt database anyway, but at least we try to recover
as much as we can using the previous checkpoint.
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com