Re: PL/PgSQL, Inheritance, Locks, and Deadlocks

From: Thomas F(dot)O'Connell <tfo(at)sitening(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org, Greg Stark <gsstark(at)mit(dot)edu>
Subject: Re: PL/PgSQL, Inheritance, Locks, and Deadlocks
Date: 2005-02-02 18:21:00
Message-ID: f97c86cf4fcd08a40532a950ab3cbb7e@sitening.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

One thing that is curious, though, is that when the AccessShareLock is
acquired by the stored procedure on an unrelated linking table, there
is also an AccessShareLock acquired on the primary key of the groups
table. The latter lock is understandable, but why would the procedure
need any locks whatsoever on linking tables on which it has no direct
effect (either reading or writing)?

-tfo

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005

On Feb 2, 2005, at 9:41 AM, Tom Lane wrote:

> "Thomas F.O'Connell" <tfo(at)sitening(dot)com> writes:
>> The linking table is a pure linking table. It has a user_id and a
>> group_id, each a foreign key. The user_id ties to the appropriate
>> subclass user table. The group_id ties to the groups table, which is
>> not part of an inheritance hierarchy. A multicolumn primary key covers
>> both foreign keys in the linking table, and the secondary column of
>> the
>> key also has its own index.
>
> Inserts/updates in a table that has a foreign key result in locks on
> the
> referenced rows in the master table. Could this explain your problem?
>
> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-02-02 18:23:11 Re: capturing/viewing sort_mem utilization on a per query basis
Previous Message Tom Lane 2005-02-02 18:17:33 Re: Invalid headers and xlog flush failures