Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> ie. why can't we just record the number of locks each backend has, sort
> of, and use a reference counting sort of method. Per-backend in case
> the backend dies and we need to discount those locks..?
Uh ... the interesting question is usually not "does this backend hold
any row locks", it is "is this row locked by any backends". If the
latter question is not *exceedingly* cheap to answer, at least in the
normal case where the answer is no, you don't have a workable solution,
because you'll be adding nontrivial overhead to every row update.
regards, tom lane