Re: Delete performance on delete from table with inherited tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Delete performance on delete from table with inherited tables
Дата
Msg-id 247.1078877237@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Delete performance on delete from table with inherited tables  (Chris Kratz <chris.kratz@vistashare.com>)
Список pgsql-performance
Chris Kratz <chris.kratz@vistashare.com> writes:
> There are about 67 inherited tables that inherit the fields from this table,
> hence the 134 constraint triggers.

Why "hence"?  Inheritance doesn't create any FK relationships.  You must
have done so.  What are those FK constraints exactly?

> Some of the documentation implies that inherited tables cause deletes to be
> very slow on the parent table, so I did the following experiment.

No, but foreign keys linked from tables that don't have indexes can be
pretty slow.

> it seems like the "delete from only..." statement should
> ignore the constraint triggers.

Why would you expect that?

It appears to me that this table is the referenced table for a large
number of foreign-key relationships, and thus when you delete a row from
it, many other tables have to be checked to verify that they do not
contain entries matching that row.  That's going to be relatively slow,
even with indexes on the other tables.  It's not very clear from your
description what the FK relationships actually do in your database
schema, but I would suggest looking at redesigning the schema so that
you do not need them.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [ADMIN] syslog slowing the database?
Следующее
От: "Gavin M. Roy"
Дата:
Сообщение: Re: [ADMIN] syslog slowing the database?