XID-assigned idle transactions affect vacuum's job. - Mailing list pgsql-hackers

From Masahiko Sawada
Subject XID-assigned idle transactions affect vacuum's job.
Date
Msg-id CAD21AoDCzkvyui_Aw3=9QjprDKtaU+-g9ALhKeActSa4BHma8A@mail.gmail.com
Whole thread Raw
Responses Re: XID-assigned idle transactions affect vacuum's job.  (Amit Kapila <amit.kapila16@gmail.com>)
Re: XID-assigned idle transactions affect vacuum's job.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

Long transactions often annoy users because if a long transaction
exists on a database vacuum cannot reclaim efficiently. There are
several reason why they exist on a database but it's a common case
where users or applications forget to commit/rollback transactions.
That is, transaction is not executing SQL and its state is 'idle in
transaction' on pg_stat_activity. In this case, such transactions
don't affect vacuum's job either if they aren't assigned transaction
id or if they don't have a snapshot. However if they have xid it will
affect vacuum's job even if they don't have a snapshot.

I think that to decide which deleted tuples must be preserved we don't
need to care about backend PGXACT.xid but must care about PGXACT.xmin.
But current GetOldestXmin considers both of them. I guess one reason
why GetOldestXmin does so is that it's also used to determine where to
truncate pg_subtrans. Is there anything else reason? If nothing, I'd
like to change GetOldestXmin so that it sees only PGXACT.xmin for
vacuum purposes. Once we addressed this issue it'll helpful especially
for user who uses read committed transaction isolation level.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Problem while setting the fpw with SIGHUP
Next
From: Amit Langote
Date:
Subject: Re: [HACKERS] Add support for tuple routing to foreign partitions