Skip site navigation (1) Skip section navigation (2)

Re: Shared row locking

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>,Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>,Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>,Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared row locking
Date: 2004-12-30 00:14:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Mon, 20 Dec 2004 21:44:01 +0100, <simon(at)2ndquadrant(dot)com> wrote:
>Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote on 20.12.2004, 19:34:21:
>> #1 could have a pretty serious performance impact, too.  For small
>> numbers of FOR UPDATE locks (too few to force spill to disk) I would
>> expect #2 to substantially beat #1.  #1 essentially imposes the worst
>> case performance at all times, whereas #2 degrades (at a currently
>> unknown rate) when there are lots and lots of FOR UPDATE locks.

I don't see too much of a difference between #1 (an on-disk structure
buffered in shared memory) and #2 (a shared memory structure spilling
to disk).

As long as we can avoid unnecessary writes, #1 has the nice property
that it automatically adapts to different usage patterns because it
uses the normal shared buffer pool and cache replacement strategy.

>[My gut feeling would be against another permanent on-disk structure,
>since this is one more thing for a user to delete "to save space"

Irrelevant, IMHO.  Whoever manually deletes any file under PGDATA
deserves whatever this may cause.

>I haven't seen many programs that use
>extended SELECT FOR UPDATE logic.

AFAICS, SELECT FOR UPDATE is not the primary issue here, because it
locks rows exclusively.  This thread is about shared locks, which
should be used for foreign key checks.


In response to


pgsql-hackers by date

Next:From: Manfred KoizarDate: 2004-12-30 00:15:45
Subject: Re: Bgwriter behavior
Previous:From: Manfred KoizarDate: 2004-12-30 00:12:01
Subject: Re: Shared row locking

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group