Re: Troubleshooting a long running delete statement

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: Troubleshooting a long running delete statement
Дата
Msg-id CAHOFxGoG1knuZUioBu-FjL-daF9t6LY1MchQ=F9U6fApW+OJaQ@mail.gmail.com
обсуждение исходный текст
Ответ на Troubleshooting a long running delete statement  ("Dirschel, Steve" <steve.dirschel@thomsonreuters.com>)
Список pgsql-performance
On Wed, Oct 6, 2021 at 12:00 PM Dirschel, Steve <steve.dirschel@thomsonreuters.com> wrote:
Here is what I could see in Postgres:
  • When I did an explain on the delete I could see it was full scanning the table. I did a full scan of the table interactively in less than 1 second so the long runtime was not due to the full tablescan.

If finding the rows is fast, but actually deleting them is slow and perhaps won't even finish, I would strongly consider adding a where clause such that a small fraction of the deletes would be done (perhaps in a transaction that gets rolled back) and do the explain (analyze, buffers) on that modified command. Yes, the planner may decide to use an index to find which rows to delete, but if finding the rows was already fast and it is the non-obvious work that we want to profile, then it should be fine to do 1% of the deletes and see how it performs and where the time goes.

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

Предыдущее
От: Mladen Gogala
Дата:
Сообщение: Re: [EXT] Re: Troubleshooting a long running delete statement
Следующее
От: Maciek Sakrejda
Дата:
Сообщение: Re: [EXT] Re: Troubleshooting a long running delete statement