Poor performance with ON DELETE CASCADE

Поиск
Список
Период
Сортировка
От Conal
Тема Poor performance with ON DELETE CASCADE
Дата
Msg-id 1190698904.122234.32760@o80g2000hse.googlegroups.com
обсуждение исходный текст
Ответы Re: Poor performance with ON DELETE CASCADE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I have a database schema which has a "central" table with several
others depending on it. The dependent tables all have foreign key
constraints with ON DELETE CASCADE so that I can remove tuples from
the "central" table and have the dependent rows removed automatically.
This all works, but it's very slow, and I can't see why. The dependent
tables are all indexed by this foreign key, so the deletions should be
very fast.

I have tried to use EXPLAIN and ANALYZE, and this tells me that the
deletion from the central table is not a problem, but that the
cascading deletions are very slow. e.g.

   Trigger for constraint topic_map_object_parent_uid_fkey:
time=93063.837 calls=115

Unfortunately EXPLAIN doesn't provide any information about the
details of how it executes the cascading deletion; there's no query
plan for this, so I can't see why it is taking so long. Is it possible
to obtain a query plan for these "cascaded" delete queries?


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

Предыдущее
От: Johann Maar
Дата:
Сообщение: Autostart PostgreSQL in Ubuntu
Следующее
От: Petri Simolin
Дата:
Сообщение: UNIQUE_VIOLATION, Finding out which index would have been violated