Re: when is a DELETE FK trigger planned?

Поиск
Список
Период
Сортировка
От Andrew Lazarus
Тема Re: when is a DELETE FK trigger planned?
Дата
Msg-id 1069587644.20080227165420@pillette.com
обсуждение исходный текст
Ответ на Re: when is a DELETE FK trigger planned?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
I figured out what appears to happen with cascading delete using a
seqscan. In this case, the foreign keys in the child table are not
equally distributed. A few parent values occur often. Most parent
values do not occur at all. So the planner, faced with an unknown
generic key, takes the safe route.

What I've done is remove the FK (maybe it would be better to leave it
albeit disabled for documentation) and written my own AFTER DELETE
trigger that uses EXECUTE to delay planning until the actual value is
known. This appears to work correctly.

--
Sincerely,
 Andrew Lazarus        mailto:andrew@pillette.com
Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: disabling an index without deleting it?
Следующее
От: Joel Stevenson
Дата:
Сообщение: Re: LISTEN / NOTIFY performance in 8.3