Re: SELECT FOR UPDATE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Swan <tswan(at)idigx(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SELECT FOR UPDATE
Date: 2003-07-25 04:10:15
Message-ID: 5397.1059106215@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Swan <tswan(at)idigx(dot)com> writes:
>>> When a SELECT FOR UPDATE query is executed, are the row level locks on a
>>> table acquired in any specific order

Nope, just whatever order the chosen plan happens to visit the tuples
in.

> I had remembered several readings on ordered locking as a method to
> prevent deadlocks, and associated that with select for update
> methodology. In theory if you aquired locks in the following order, for
> each table/relation (in oid order) get rows/tuples (in oid order), you
> could help avoid deadlock by never gaining a lock ahead of someone
> else.

Hmmm .... this would only help for situations where all the locks of
interest are grabbed in a single scan. I suppose that has some
usefulness, but it can hardly be said to eliminate deadlocks. I kinda
doubt it's worth the trouble.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-07-25 04:16:13 Re: name of configure threading option
Previous Message Larry Rosenman 2003-07-25 01:46:11 Re: name of configure threading option