Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Thomas F.O'Connell" <tfo@xxxxxxxxxxxx> 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


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux