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

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: PL/PgSQL, Inheritance, Locks, and Deadlocks
Дата
Msg-id 87lla7o5vz.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на PL/PgSQL, Inheritance, Locks, and Deadlocks  (Thomas F.O'Connell <tfo@sitening.com>)
Ответы Re: PL/PgSQL, Inheritance, Locks, and Deadlocks  (Thomas F.O'Connell <tfo@sitening.com>)
Список pgsql-general
"Thomas F.O'Connell" <tfo@sitening.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Does indexing help >= as well as = for integer columns?
Следующее
От: William Yu
Дата:
Сообщение: Weird PostgreSQL crashes on FC2/FC3 64-bit