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

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PL/PgSQL, Inheritance, Locks, and Deadlocks
Date: 2005-02-02 06:03:28
Message-ID: 87lla7o5vz.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


"Thomas F.O'Connell" <tfo(at)sitening(dot)com> writes:

> UPDATE groups
> SET count1 = v_group_count1, count2 = v_group_count2, count3 =

>
> For instance, when run, this stored procedure could try to acquire a lock on
> users2_groups despite not directly referencing it.

Does the users2_groups contain a foreign key reference to the groups table? If
so then if you need to update the groups table regularly you'll want an index
on the referring column. Otherwise in order to check the constraint Postgres
needs to do a sequential scan of the referring table to make sure your update
doesn't break a reference.

I don't know how this plays with locks though.

--
greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message William Yu 2005-02-02 06:07:27 Weird PostgreSQL crashes on FC2/FC3 64-bit
Previous Message Michael Ben-Nes 2005-02-02 05:58:40 Wierd memory problem with Apache / PHP. Related to pg_query ?