From: Sergei Kornilov <sk@zsrv.org>
To: 石勇虎 <shiyonghu651@pingan.com.cn>
To: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: 答复: autovacuum can not remove dead tuples
Date: Wed, 04 Apr 2018 09:45:21 +0300
Message-ID: <2899571522824321@web50j.yandex.ru> (raw)
In-Reply-To: <020adf37a8d54e79b0b797590252a24b@pingan.com.cn>
References: <aa51d463ae8f410a8d5c4eb120e9bdc1@pingan.com.cn>
<1147541522765130@web44j.yandex.ru>
<020adf37a8d54e79b0b797590252a24b@pingan.com.cn>
Hello
Yes, any session in transaction will prevent vacuum some rows. Regardless DISABLE_PAGE_SKIPPING or any other option, this is not bug. Vacuum should not remove any deleted row which can be accessible by any running transaction.
You can use idle_in_transaction_session_timeout to prevent long idle in transaction state. But i use simple crontab like this:
*/10 * * * * psql -d postgres -tx -c "SELECT pg_terminate_backend(pid),now(),now()-xact_start as duration,* from pg_stat_activity where (now() - pg_stat_activity.xact_start) > '1 hour'::interval and usename NOT IN ('postgres') and state<>'idle'"
to terminate any long running transaction. Time interval changed by database workload, for web requests can be 5min.
regards, Sergei
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: sk@zsrv.org, shiyonghu651@pingan.com.cn
Subject: Re: 答复: autovacuum can not remove dead tuples
In-Reply-To: <2899571522824321@web50j.yandex.ru>
References: <aa51d463ae8f410a8d5c4eb120e9bdc1@pingan.com.cn> <1147541522765130@web44j.yandex.ru> <020adf37a8d54e79b0b797590252a24b@pingan.com.cn> <2899571522824321@web50j.yandex.ru>
* 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