Unbearably slow cascading deletes

Поиск
Список
Период
Сортировка
От andrew@pillette.com
Тема Unbearably slow cascading deletes
Дата
Msg-id 200407201919.i6KJJBw08728@pillette.com
обсуждение исходный текст
Ответы Re: Unbearably slow cascading deletes  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: Unbearably slow cascading deletes  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Список pgsql-performance
I have (among other things) a parent table with 200 records and a child table with 20MM or more. I set up referential
integrityon the FK with ON DELETE CASCADE. 

It appears that when a DELETE is done on the parent table, the child table deletion is done with a sequential scan. I
saythis because it took over four minutes to delete a parent record THAT HAD NO CHILDREN. The DB is recently analyzed
andSELECTs in the child table are done by the appropriate index on the FK. 

Let me guess, the cascade trigger's query plan is decided at schema load time, when the optimizer has no clue. Is there
away to fix this without writing my own triggers, using PL/PGSQL EXECUTE to delay the planner? 

And by the way, if FK conditions like IN (1,3,4) could be handled in a single invocation of the trigger, so much the
better.


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

Предыдущее
От: Rod Taylor
Дата:
Сообщение: Re: NAS, SAN or any alternate solution ?
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Unbearably slow cascading deletes