Re: atrocious update performance

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: atrocious update performance
Дата
Msg-id 871xnt1c5h.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: atrocious update performance  ("Rosser Schwarz" <rschwarz@totalcardinc.com>)
Список pgsql-performance
"Rosser Schwarz" <rschwarz@totalcardinc.com> writes:

> Actually, there are no foreign keys to those columns.  Once they're
> populated, I'll apply a foreign key constraint and they'll refer to the
> appropriate row in the prod and subprod tables, but nothing will
> reference account.cust.[sub]prodid.  There are, of course, several foreign
> keys referencing account.cust.custid.

Just to be clear, the foreign key constraints they're worrying about are not
constraints on the table you're updating. They're constraints on other tables
referring to the table you're updating.

Since you're updating the column here postgres has to be sure nothing is
referring to the old value you're obliterating, and to do that it has to
select for possible records in the referencing tables referring to the value.
If there are any references in other tables referring to this column then you
need an index on the column in the referencing table to be able to update the
column in referenced table efficiently.

--
greg

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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: rapid degradation after postmaster restart
Следующее
От: Shridhar Daithankar
Дата:
Сообщение: Re: atrocious update performance