Re: Reducing relation locking overhead

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reducing relation locking overhead
Date: 2005-12-04 03:38:28
Message-ID: dmto9l$1h38$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote
>
> The real situation is that you must hold at least AccessShareLock on the
> table throughout the entire operation, else you have no defense against
> (say) someone dropping the index or the entire table out from under you.
> And when you add onto this lock in order to lock out writers
> temporarily, you are engaging in a lock upgrade, which can deadlock
> against any sort of exclusive lock request. The fact that you've been
> holding the AccessShareLock for quite a long time means that the window
> for deadlock problems is very wide.
>

Maybe the deadlock problem is solvable, our current deadlock removal
mechanism is like this:

/* who wakes up first who removes himself -- quite unfair :-( */
RemoveFromWaitQueue(MyProc);

What if we change to cost-based removal, i.e., remove the one whose cost is
smaller. In this case, an two-days-to-be-done reindex should never get
killed.

Regards,
Qingqing

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-12-04 03:45:52 Re: [PATCHES] snprintf() argument reordering not working under
Previous Message Bruce Momjian 2005-12-04 02:38:14 Re: Numeric 508 datatype