Seeing how PITR, nested transactions, and other exciting developments 
related to transactions are being developed, I am getting curious about how 
PostgreSQL actually implements transactions. Investigating Materialized 
Views has led me to look closely at how transactions work and such.

Do you know of good resources on learning how transactions are implemented 
in PostgreSQL? Should I just peruse the code? Which files are most 
relevant?

-- 
Jonathan Gardner
jgardner@jonathangardner.net

Thu, 3 Jun 2004 17:38:21 -0700
Jonathan Gardner <jgardner@jonathangardner.net>
Understanding transactions
On Thu, Jun 03, 2004 at 05:38:21PM -0700, Jonathan Gardner wrote:

> Do you know of good resources on learning how transactions are implemented 
> in PostgreSQL? Should I just peruse the code? Which files are most 
> relevant?

backend/access/transam/xact.c (high level transaction status) and
backend/utils/time/tqual.c (low level tuple visibility test --- this is
hard to read and understand) and its respective header files are the most
relevant.  See also htup.h about "heap tuples," specially heap tuple
headers and the games with Xmin, Xmax, Cmin and Cmax.


Not sure about other literature.  Make sure you understand how MVCC
works before reading the code ...

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Y dijo Dios: "Que sea Satanï¿½s, para que la gente no me culpe de todo a mï¿½."
"Y que hayan abogados, para que la gente no culpe de todo a Satanï¿½s"


Thu, 3 Jun 2004 21:18:55 -0400
Alvaro Herrera <alvherre@dcc.uchile.cl>
Re: Understanding transactions
Jonathan Gardner wrote:
> Seeing how PITR, nested transactions, and other exciting developments 
> related to transactions are being developed, I am getting curious about how 
> PostgreSQL actually implements transactions. Investigating Materialized 
> Views has led me to look closely at how transactions work and such.
> 
> Do you know of good resources on learning how transactions are implemented 
> in PostgreSQL? Should I just peruse the code? Which files are most 
> relevant?

Next to diving into the code you might want to dive into the 
theory. Chapter 5 of "Concurrency Control and Recovery in 
Database Systems" deals with Multi Version Concurrency Control: 
http://research.microsoft.com/pubs/ccontrol/

Jochem

Fri, 04 Jun 2004 12:49:20 +0200
Jochem van Dieten <jochemd@oli.tudelft.nl>
Re: Understanding transactions