Re: admin control over cancelling autovacuum when blocked by a lock

Поиск
Список
Период
Сортировка
От Rui DeSousa
Тема Re: admin control over cancelling autovacuum when blocked by a lock
Дата
Msg-id CB30B39F-CE56-417A-8CFB-C23F07DD51B8@crazybean.net
обсуждение исходный текст
Ответ на Re: admin control over cancelling autovacuum when blocked by a lock  (John Lumby <johnlumby@hotmail.com>)
Ответы Re: admin control over cancelling autovacuum when blocked by a lock  (John Lumby <johnlumby@hotmail.com>)
Список pgsql-admin


On Apr 30, 2019, at 4:04 PM, John Lumby <johnlumby@hotmail.com> wrote:

surely the user would prefer that the 
ANALYZE would wait until after
the autovacuum has finished

Not really… analyze takes an exclusive lock; I believe.  The result is that readers/analyze will block other readers and writes which is bad for concurrency.  Readers should never be blocked :)… 

I had the follow problem occur; which I hope will illustrate why you wouldn’t what do what you are recommending. 

I explicitly do not allow the application to issue DDL including the analyze command against the base tables; however, developers are developers and they will try anything at least once.  The application was coded with an analyze command and the result was huge blocking issues.

1. Application issue analyze
2. Analyze waits on exclusive lock
3. As, there is already a long running query running against the table
4. New readers; get blocked and are now waiting behind the analyze command.
5. Writes are also blocked and waiting behind the analyze command.
6. Long running query completes.
7. Analyze command fails due to lack of permissions.
8. Application retries; rinse and repeat.

* The real response is we had to kill the session attempting to issue analyze and issue a hot fix otherwise the blocking would cause all sorts of application issues.  



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

Предыдущее
От: John Lumby
Дата:
Сообщение: Re: admin control over cancelling autovacuum when blocked by a lock
Следующее
От: John Lumby
Дата:
Сообщение: Re: admin control over cancelling autovacuum when blocked by a lock