Re: [GENERAL] Autovacuum stuck for hours, blocking queries - Mailing list pgsql-general

From Rakesh Kumar
Subject Re: [GENERAL] Autovacuum stuck for hours, blocking queries
Date
Msg-id BN6PR2201MB15541F974315051F254D08C68C5D0@BN6PR2201MB1554.namprd22.prod.outlook.com
Whole thread Raw
In response to Re: [GENERAL] Autovacuum stuck for hours, blocking queries  (Hannes Erven <hannes@erven.at>)
Responses Re: [GENERAL] Autovacuum stuck for hours, blocking queries  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
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.

pgsql-general by date:

Previous
From: Richard Brosnahan
Date:
Subject: [GENERAL] Re: [GENERAL] PostgreSQL mirroring from RPM install to RPM install-revisited
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] PostgreSQL mirroring from RPM install to RPMinstall-revisited