Re: ALTER STATEMENT getting blocked

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER STATEMENT getting blocked
Дата
Msg-id 4178687.1674150355@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ALTER STATEMENT getting blocked  (aditya desai <admad123@gmail.com>)
Ответы Re: ALTER STATEMENT getting blocked  (MichaelDBA <MichaelDBA@sqlexec.com>)
Список pgsql-performance
aditya desai <admad123@gmail.com> writes:
> We have a Postgres 11.16 DB which is continuously connected to informatica
> and data gets read from it continuously.

> When we have to ALTER TABLE.. ADD COLUMN.. it gets blocked by the SELECTs
> on the table mentioned by process above.

> Is there any way to ALTER the table concurrently without  getting blocked?
> Any parameter or option? Can someone give a specific command?

ALTER TABLE requires exclusive lock to do that, so it will queue up
behind any existing table locks --- but then new lock requests will
queue up behind its request.  So this'd only happen if your existing
reading transactions don't terminate.  Very long-running transactions
are unfriendly to other transactions for lots of reasons including
this one; see if you can fix your application to avoid that.  Or
manually cancel the blocking transaction(s) after the ALTER begins
waiting.

            regards, tom lane



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

Предыдущее
От: aditya desai
Дата:
Сообщение: ALTER STATEMENT getting blocked
Следующее
От: MichaelDBA
Дата:
Сообщение: Re: ALTER STATEMENT getting blocked