Extremely slow DELETE with cascade foreign keys

Поиск
Список
Период
Сортировка
От Rodrigo Rosenfeld Rosas
Тема Extremely slow DELETE with cascade foreign keys
Дата
Msg-id 8f569ed9-fde9-1fe7-4beb-01945009e040@gmail.com
обсуждение исходный текст
Ответы Re: Extremely slow DELETE with cascade foreign keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Extremely slow DELETE with cascade foreign keys  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-performance
Hi, I think something changed recently in my development environment as 
I don't recall deletes being so slow before.

I've created a new dump and restored to a new database, ran VACUUM FULL 
ANALYSE and a simple delete takes forever as you can see here:


explain analyze delete from field_values where transaction_id=226;
QUERY PLAN

---------------------------------------------------------------------------------------------------------------------------------------------------------------
  Delete on field_values  (cost=0.43..257.93 rows=481 width=6) (actual 
time=367375.805..367375.805 rows=0 loops=1)
    ->  Index Scan using index_field_values_on_transaction_id on 
field_values  (cost=0.43..257.93 rows=481 width=6) (actual 
time=0.223..4.216 rows=651 loops=1)
          Index Cond: (transaction_id = 226)
  Planning time: 0.234 ms
  Execution time: 367375.882 ms
(5 registros)

Time: 367377,085 ms (06:07,377)


Any ideas on what could be causing this? Could it be an issue with my 
hard drive?

There aren't that many records to delete from the other tables 
referencing field_values. I've done this sort of operation earlier this 
year and it was quite fast. Any clues?

Thanks in advance,

Rodrigo.



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

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: vacuum after truncate
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Extremely slow DELETE with cascade foreign keys