Re: Avoiding Refreezing XIDs Repeatedly

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Matheus de Oliveira <matioli(dot)matheus(at)gmail(dot)com>
Cc: bkrug <bkrug(at)usatech(dot)com>, pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Avoiding Refreezing XIDs Repeatedly
Date: 2015-02-09 17:06:32
Message-ID: 20150209170632.GD3391@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Matheus de Oliveira wrote:
> On Mon, Feb 9, 2015 at 1:58 PM, bkrug <bkrug(at)usatech(dot)com> wrote:
>
> > Couldn't postgres reserve a special XID that is never available for normal
> > transactions but that indicates that any transaction can see it because it
> > is so old? Then instead of constantly having to freeze old XIDs each time
> > the XID is going to wrap, vacuum can just set it to the special XID and
> > never touch it again unless something really changes.
> >
>
>
> It changed in recent versions (9.3 or 9.4, I don't recall exactly which)
> and moved to tuple header, but what you described is exactly what was done,
> the xid was 2.

Actually, it's been done this way for ages -- it was introduced in 2001
(release 7.2) by these commits:

Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Branch: master Release: REL7_2 [2589735da] 2001-08-25 18:52:43 +0000

Replace implementation of pg_log as a relation accessed through the
buffer manager with 'pg_clog', a specialized access method modeled
on pg_xlog. This simplifies startup (don't need to play games to
open pg_log; among other things, OverrideTransactionSystem goes away),
should improve performance a little, and opens the door to recycling
commit log space by removing no-longer-needed segments of the commit
log. Actual recycling is not there yet, but I felt I should commit
this part separately since it'd still be useful if we chose not to
do transaction ID wraparound.

Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Branch: master Release: REL7_2 [bc7d37a52] 2001-08-26 16:56:03 +0000

Transaction IDs wrap around, per my proposal of 13-Aug-01. More
documentation to come, but the code is all here. initdb forced.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message David G Johnston 2015-02-09 18:17:52 Re: Migrating a FoxPro system and would like input on the best way to achieve optimal performance
Previous Message Matheus de Oliveira 2015-02-09 16:48:17 Re: Avoiding Refreezing XIDs Repeatedly