Re: deleting rows with foreign keys

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: deleting rows with foreign keys
Дата
Msg-id 4596.1184196267@sss.pgh.pa.us
обсуждение исходный текст
Ответ на deleting rows with foreign keys  (Tom Allison <tom@tacocat.net>)
Список pgsql-general
Tom Allison <tom@tacocat.net> writes:
> I have ~250K rows in this table.
> the token_idx is referenced in two other tables, both of whom have a
> foreign key constraint to ON DELETE CASCADE.
> Of the other two tables, one has ~1M rows and the other ~350K rows.

> Problem:
> Deleting one row can take 2 seconds.

> Is there something I can do to improve the speed.

Put indexes on the referencing columns.  Without that, a seqscan is
required to look for referencing rows.

            regards, tom lane

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

Предыдущее
От: Tom Allison
Дата:
Сообщение: deleting rows with foreign keys
Следующее
От: alexander lunyov
Дата:
Сообщение: Re: russian case-insensitive regexp search not working