Re: Extremely slow DELETE with cascade foreign keys

Поиск
Список
Период
Сортировка
От Rodrigo Rosenfeld Rosas
Тема Re: Extremely slow DELETE with cascade foreign keys
Дата
Msg-id 734f6343-35f6-1d1d-3fd7-87e1a1dea9da@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
Список pgsql-performance
Em 05-12-2017 15:25, Tom Lane escreveu:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
>> Rodrigo Rosenfeld Rosas wrote:
>>> 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)
>> Normally this is because you lack indexes on the referencing columns, so
>> the query that scans the table to find the referencing rows is a
>> seqscan.
> Actually though ... the weird thing about this is that I'd expect to
> see a separate line in the EXPLAIN output for time spent in the FK
> trigger.  Where'd that go?
>
>             regards, tom lane


Yes, I was also hoping to get more insights through the EXPLAIN output :)



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

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