Re: locks in CREATE TRIGGER, ADD FK - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: locks in CREATE TRIGGER, ADD FK
Date
Msg-id 200503280504.j2S541B12913@candle.pha.pa.us
Whole thread Raw
In response to Re: locks in CREATE TRIGGER, ADD FK  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-hackers
Alvaro Herrera wrote:
> On Wed, Mar 23, 2005 at 10:42:01AM +0800, Christopher Kings-Lynne wrote:
> > >>If you want to be my friend forever, then fix CLUSTER so that it uses 
> > >>sharerowexclusive as well :D
> > >
> > >I don't think it's as easy as that, because you have to move tuples
> > >around in the cluster operation.  Same sort of issue as vacuum full I 
> > >would suggest.
> > 
> > Cluster doesn't move rows...
> > 
> > I didn't say it was easy.  It would involve changing how cluster works. 
> >  It would keep the old table around while building the new, then grab 
> > an exclusive lock to swap the two.
> 
> Huh, cluster already does that.
> 
> I don't remember what the rationale was for locking the table, leaving
> even simple SELECTs out.  (In fact, IIRC the decision wasn't made by me,
> and it wasn't discussed at all.)
> 

The issue is that we would have to escalate the shared lock to exclusive
to swap out the files, and lock escallation could lead to
deadlock/starvation.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Jaime Casanova
Date:
Subject: Re: rewriter in updateable views
Next
From: Oleg Bartunov
Date:
Subject: Re: postgreSQL and history of relational databases