On 7 December 2010 19:10, Robert Haas <robertmhaas@gmail.com> wrote:
>> I'm not very familiar with PostgreSQL code but if we're
>> brainstorming... if you're only trying to protect against a small
>> number of expensive operations (like DROP, etc.) that don't really
>> happen often, wouldn't an atomic reference counter be good enough for
>> the purpose (e.g. the expensive operations would spin-wait until the
>> counter is 0)?
>
> No, because (1) busy-waiting is only suitable for locks that will only
> be held for a short time, and an AccessShareLock on a table might be
> held while we read 10GB of data in from disk,
Generally yes, but a variant with adaptive sleeping could possibly be
used if it would be acceptable to delay (uncertainly) the already
expensive and rare operations.
> and (2) that wouldn't
> allow for deadlock detection.
Probably :)