Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bC6tx-0004a6-1U for pgsql-docs@arkaria.postgresql.org; Sun, 12 Jun 2016 15:02:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bC6tw-0007r0-KT for pgsql-docs@arkaria.postgresql.org; Sun, 12 Jun 2016 15:02:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bC6tZ-00073Y-TO for pgsql-docs@postgresql.org; Sun, 12 Jun 2016 15:01:49 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bC6tW-00039S-1f for pgsql-docs@postgresql.org; Sun, 12 Jun 2016 15:01:49 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 73B2F21C8BA6 for ; Sun, 12 Jun 2016 18:01:44 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PwTkES8GpVsO for ; Sun, 12 Jun 2016 18:01:42 +0300 (MSK) Received: from [192.168.1.38] (broadband-46-188-126-133.2com.net [46.188.126.133]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 90AB421C892A for ; Sun, 12 Jun 2016 18:01:42 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1465743702; bh=yvzwAYpJXPIS5/JS8E5uDtFBGiRsv57gDaCWFMSoaU8=; h=From:Subject:To:Date; b=UnmtEnWFTMivvV8kfpk70mUNo+AByDjqzppf7zRV4l5mZy3Ghw2gkmtZvR2x/CyNd z7yNrcO6f9Pv1j66YJ/3vaGvGpK2XLHQv1XOD9PNV4+J+6ZUa4Y51yRxmUWvkgMryj H6eqjjkjCkNT8CQnM/Sc3Fz06iXaJHlqzSD8exLo= From: Egor Rogov Subject: FrozenTransactionId To: pgsql-docs@postgresql.org Message-ID: <575D7955.6060209@postgrespro.ru> Date: Sun, 12 Jun 2016 18:01:41 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030701020808000009080206" X-Pg-Spam-Score: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org This is a multi-part message in MIME format. --------------030701020808000009080206 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Since 9.4 FrozenTransactionId is no longer used to freeze row versions. The change was done by commit 37484ad: > Instead of changing the tuple xmin to FrozenTransactionId, the combination > of HEAP_XMIN_COMMITTED and HEAP_XMIN_INVALID, which were previously never > set together, is now defined as HEAP_XMIN_FROZEN. But we still have FrozenTransactionId mentioned in section 23.1.5. Please consider the attached patch to fix it. Thanks, Egor Rogov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------030701020808000009080206 Content-Type: text/x-patch; name="maintenance.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="maintenance.patch" diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index 5204b34..8b966cc 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -403,28 +403,22 @@ The reason that periodic vacuuming solves the problem is that - VACUUM will mark rows as frozen, indicating that - they were inserted by a transaction which committed sufficiently far in - the past that the effects of the inserting transaction is certain to be - visible, from an MVCC perspective, to all current and future transactions. - PostgreSQL reserves a special XID, - FrozenTransactionId, which does not follow the normal XID - comparison rules and is always considered older - than every normal XID. Normal XIDs are - compared using modulo-232 arithmetic. This means - that for every normal XID, there are two billion XIDs that are - older and two billion that are newer; another - way to say it is that the normal XID space is circular with no - endpoint. Therefore, once a row version has been created with a particular - normal XID, the row version will appear to be in the past for - the next two billion transactions, no matter which normal XID we are - talking about. If the row version still exists after more than two billion - transactions, it will suddenly appear to be in the future. To - prevent this, frozen row versions are treated as if the inserting XID were - FrozenTransactionId, so that they will appear to be - in the past to all normal transactions regardless of wraparound - issues, and so such row versions will be valid until deleted, no matter - how long that is. + VACUUM will mark rows as frozen (by setting + appropriate hint bits), indicating that they were inserted by a transaction + which committed sufficiently far in the past that the effects of the + inserting transaction is certain to be visible, from an MVCC perspective, + to all current and future transactions. Usually XIDs are compared using + modulo-232 arithmetic. This means that for every XID, there + are two billion XIDs that are older and two billion that are + newer; another way to say it is that the XID space is circular + with no endpoint. Therefore, once a row version has been created with a + particular XID, the row version will appear to be in the past for + the next two billion transactions. If the row version still exists after + more than two billion transactions, it will suddenly appear to be in the + future. To prevent this, usual visibility rules are not applied to frozen + row versions. Instead they are considered to be in the past to + all transactions regardless of wraparound issues, and so such row versions + will be valid until deleted, no matter how long that is. --------------030701020808000009080206 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --------------030701020808000009080206--