Re: [GENERAL] Autovacuum stuck for hours, blocking queries

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: [GENERAL] Autovacuum stuck for hours, blocking queries
Дата
Msg-id CAOR=d=3sd2myXutOoSEr0D_CevaiLhYGc9++CugzXkU9QA=M3w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Autovacuum stuck for hours, blocking queries  (Rakesh Kumar <rakeshkumar464@outlook.com>)
Ответы Re: [GENERAL] Autovacuum stuck for hours, blocking queries  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-general
On Fri, Feb 17, 2017 at 1:38 PM, Rakesh Kumar
<rakeshkumar464@outlook.com> wrote:
> LOCK TABLE yourtable <a suitable LOCKMODE>;
> CREATE TEMPORARY TABLE keep AS SELECT * FROM yourtable WHERE <keep>;
> TRUNCATE yourtable;
> INSERT INTO yourtable SELECT * from keep;
> COMMIT;
> ===
> the above snippet assumes truncate in PG can be in a transaction. In other words, while truncate by itself
> is atomic, it can't be rolled back. So in the above case, if "INSERT INTO yourtable SELECT * from keep;" and
> we rollback, will it rollback yourtable.


Yes it can. Truncate has been rollbackable for a while now.

begin;
create table
insert into table
truncate old table
. something goes wrong .
rollback;

Unless I misunderstand your meaning.


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

Предыдущее
От: Richard Brosnahan
Дата:
Сообщение: Re: [GENERAL] PostgreSQL mirroring from RPM install to RPMinstall-revisited
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [GENERAL] Autovacuum stuck for hours, blocking queries