Re: Deletes from tables with foreign keys taking too long

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Deletes from tables with foreign keys taking too long
Дата
Msg-id 200210011444.05157.josh@agliodbs.com
обсуждение исходный текст
Ответ на Deletes from tables with foreign keys taking too long  ("Adam Siegel" <adam@sycamorehq.com>)
Список pgsql-performance
Adam,

> I have a table that has about 200 rows in it.  I have 2 other tables that
> have about 300,000 rows each that reference the first table through a
> foriegn key.  I run a process that rebuilds these tables.  First I delete
> the rows in the large tables (takes about 30 seconds), then I delete the
> the rows in the first table (takes about 5 minutes !!!).  Each of these are
> done in separate transactions.

Not that this answers your performance questions, but you will be able to do
this faster if you use TRUNCATE instead of DELETE.

--
Josh Berkus
josh@agliodbs.com
Aglio Database Solutions
San Francisco

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Deletes from tables with foreign keys taking
Следующее
От: Josh Berkus
Дата:
Сообщение: Comparitive UPDATE speed