Re: buffer page lock vs tuple lock (?) - Mailing list pgsql-novice

From Decibel!
Subject Re: buffer page lock vs tuple lock (?)
Date
Msg-id 20070808222021.GC20424@nasby.net
Whole thread Raw
In response to buffer page lock vs tuple lock (?)  (Luca Ferrari <fluca1978@infinito.it>)
List pgsql-novice
On Tue, Aug 07, 2007 at 09:52:40AM +0200, Luca Ferrari wrote:
> Hi,
> if I get it right a heap buffer page (that contains several tuples) requires a
> pin and a lock to access the page content, and a change to a tuple requires a
> lock on the tuple too. Disregarding some cases (tuple shuffling within the
> same page and vacuum) does not this double locking be too much? I mean, does
> not suffice to pin the page and lock the tuple (e.g., reading)?
> Can anybody help me understanding?

There's two different types of locking involved here. The page locking
mechanism is strictly internal-only, and is used only to ensure that
data on a page can't be corrupted by concurrent operations. But there's
a number of operations that can modify a page, many of which will never
acquire any row locks.

Row locks OTOH are used for transaction isolation. The two concepts are
actually separate.
--
Decibel!, aka Jim Nasby                        decibel@decibel.org
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

Attachment

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: casts for user defined types
Next
From: Chirag Patel
Date:
Subject: horizontal clustering?