From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: gsaviane@gmail.com
Subject: BUG #16614: Stale temporary objects makes vacuum ineffective when 1 million transactions remain
Date: Thu, 10 Sep 2020 08:45:19 +0000
Message-ID: <16614-23e5c4c4567d1576@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16614
Logged by: Giorgio Saviane
Email address: gsaviane@gmail.com
PostgreSQL version: 9.5.23
Operating system: Linux
Description:
We noticed the same issue described below occurring multiple times in some
of our many Postgres 9.5 deployments.
The application makes extensive use of temporary tables. Although there are
scheduled activities for regularly vacuuming the database, after some months
of uptime the database gets into the 1 million transactions limit. Even
though we perform a manual maintenance by vacuuming in single user mode, the
server keeps returning the same warning and hint:
WARNING: database "mydb" must be vacuumed within (X<1000000) transactions
HINT: To avoid a database shutdown, execute a database-wide VACUUM in
"mydb".
Any further vacuum command issued completes but the warning keeps showing
up, and the remaining transactions are decremented.
Only by removing all the stale temporary objects with
DO $$
DECLARE rec RECORD;
BEGIN FOR rec IN
SELECT 'DROP schema ' || nspname || ' CASCADE' AS stmt
FROM pg_catalog.pg_namespace
WHERE nspname LIKE 'pg_temp%' OR nspname LIKE 'pg_toast_temp%'
LOOP
EXECUTE rec.stmt;
END LOOP;
END;
$$
Makes the vacuum command complete without warnings.
We think that stale temporary objects are somehow blocking the vacuuming of
the database.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, gsaviane@gmail.com
Subject: Re: BUG #16614: Stale temporary objects makes vacuum ineffective when 1 million transactions remain
In-Reply-To: <16614-23e5c4c4567d1576@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox