Re: help with locked table(s)/transactions(s) - Mailing list pgsql-general

From Tom Lane
Subject Re: help with locked table(s)/transactions(s)
Date
Msg-id 29624.1138803851@sss.pgh.pa.us
Whole thread Raw
In response to Re: help with locked table(s)/transactions(s)  (Mott Leroy <mott@acadaca.com>)
Responses Re: help with locked table(s)/transactions(s)  (Mott Leroy <mott@acadaca.com>)
List pgsql-general
Mott Leroy <mott@acadaca.com> writes:
> I'm still confused by the behavior however. The locking behaves as if
> its some kind of *table* level lock, because while the function is
> executing (a long time), a dozen updates and inserts build up waiting
> for some lock to be released. If the loop just occassionally puts a lock
> on a few different rows, I don't see how that could cause the
> experienced behavior -- presumably the lock on those particular rows is
> released after its iteration through the loop. Unless, of course, the
> lock isn't given up ...

No, the locks would be held till end of transaction.  It is a little odd
that you have so many conflicts, though, unless the referenced table is
pretty small and/or this loop manages to touch a large fraction of the
possible keys.

            regards, tom lane

pgsql-general by date:

Previous
From: Adam Witney
Date:
Subject: Passwords when changing users -> roles
Next
From: "mmuurr[AT]gmail.com"
Date:
Subject: function returns setof column type problems