Re: Reducing some DDL Locks to ShareLock

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reducing some DDL Locks to ShareLock
Date: 2008-11-12 22:53:35
Message-ID: 1226530415.27904.394.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Wed, 2008-11-12 at 16:25 -0500, Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> > On Tue, 2008-11-11 at 21:57 -0500, Tom Lane wrote:
> >> I was imagining that the heap_inplace_update operation would release the
> >> lock. Is there some problem with the concept?
>
> > Not the concept, just the mechanism.
>
> > Current tuple lock requestors do XactLockTableWait() which waits until
> > the lock on the transaction is released and removed from procarray.
>
> Ah, I see. Yeah, that won't work nicely.
>
> > The only way I can see to do this is by having another lock type, using
> > an additional info bit on t_infomask2.
>
> The alternative I was thinking about involved taking an exclusive buffer
> lock on the page containing the tuple to be updated in-place. The point
> being that you have to examine the old tuple contents and decide whether
> to update after you have lock, not before. I think this would amount to
> refactoring heap_inplace_update into two operations: fetch/lock and
> update/unlock. (I guess there should be a third function to release
> without updating, too --- that would really just be an unlock-buffer
> operation, but it'd be better if callers didn't explicitly know that.)
> The callers would probably still use the syscache to obtain the tuple
> address, but they wouldn't rely on it to supply the tuple image.

I'll look into this.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-11-13 00:24:01 Re: [GENERAL] Very slow queries w/ NOT IN preparation (seems like a bug, test case)
Previous Message Tony Fernandez 2008-11-12 22:52:07 ERROR: incompatible library