Re: Some newbie questions - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Some newbie questions
Date
Msg-id 20080908132026.GA4411@alvh.no-ip.org
Whole thread Raw
In response to Re: Some newbie questions  (M2Y <mailtoyahoo@gmail.com>)
List pgsql-hackers
M2Y escribió:

> On Sep 7, 11:52 pm, pgsql@Sheeky.Biz (Shane Ambler) wrote:
> > > What is a good way to start understanding backend(postgres) code? Is
> > > there any documentation available especially for developers?

> > > What is commit log and why it is needed?
> >
> > To achieve ACID (Atomic, Consistent, Isolatable, Durable)
> > The changes needed to complete a transaction are saved to the commit log
> > and flushed to disk, then the data files are changed. If the power goes
> > out during the data file modifications the commit log can be used to
> > complete the changes without losing any data.
> 
> This, I think, is transaction log or XLog. My question is about CLog
> in which two bits are there for each transaction which will denote the
> status of transaction. Since there is XLog from which we can determine
> what changes we have to redo and undo, what is the need for this CLog.

That's correct -- what Shane is describing is the transaction log
(usually know here as WAL).  However, this xlog is write-only (except in
the case of a crash); clog is read-write, and must be fast to query
since it's used very frequently to determine visibility of each tuple.
Perhaps what you need to read is the chapter on our MVCC implementation,
which relies heavily on clog.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] Cleanup of GUC units code
Next
From: Martin Pihlak
Date:
Subject: Re: reducing statistics write overhead