Re: Some newbie questions

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: M2Y <mailtoyahoo(at)gmail(dot)com>
Cc: Shane Ambler <pgsql(at)sheeky(dot)biz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some newbie questions
Date: 2008-09-08 13:20:26
Message-ID: 20080908132026.GA4411@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

M2Y escribió:

> On Sep 7, 11:52 pm, pgsql(at)Sheeky(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Martin Pihlak 2008-09-08 13:25:20 Re: reducing statistics write overhead
Previous Message Greg Stark 2008-09-08 13:18:55 Re: [PATCH] Cleanup of GUC units code