Re: Simple delete takes hours

Поиск
Список
Период
Сортировка
От Thomas Mueller
Тема Re: Simple delete takes hours
Дата
Msg-id d0cdoh$tap$1@sea.gmane.org
обсуждение исходный текст
Ответ на Re: Simple delete takes hours  (PFC <lists@boutiquenumerique.com>)
Список pgsql-sql
On 05.03.2005 00:24 PFC wrote:

>     Every time a row is removed from pwd_name, the ON DELETE CASCADE
> trigger  will look in pwd_name_rev if there is a row to delete... Does
> it have an  index on pwd_name_rev( rev_of ) ? If not you'll get a full
> table scan for  every row deleted in pwd_name...

Yes that's it, thanks a lot!


pwdcheck=# explain analyze delete from pwd_name where description=1;
 QUERY PLAN
 

-------------------------------------------------------------------------------------------------------------------------Seq
Scanon pwd_name  (cost=0.00..116571.15 rows=1774250 width=6)
 
(actual time=9526.671..21957.920 rows=543348 loops=1)  Filter: (description = 1)Total runtime: 35555.749 ms
(3 rows)

Is it possible to get fired triggers/called stored procedures and things
like that in an 'explain' ?

To find out why the delete is that slow I did:
pwdcheck=# explain analyze delete from pwd_name where id in
pwdcheck-# (select id from pwd_name where description=1 limit 10);

There was no hint that every deleted row leads to a full table scan.


Thomas



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: truncating table permissions
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Postgresql FK to MS SQL triggers