Re: Avoiding Refreezing XIDs Repeatedly - Mailing list pgsql-performance

From Alvaro Herrera
Subject Re: Avoiding Refreezing XIDs Repeatedly
Date
Msg-id 20150209170632.GD3391@alvh.no-ip.org
Whole thread Raw
In response to Re: Avoiding Refreezing XIDs Repeatedly  (Matheus de Oliveira <matioli.matheus@gmail.com>)
List pgsql-performance
Matheus de Oliveira wrote:
> On Mon, Feb 9, 2015 at 1:58 PM, bkrug <bkrug@usatech.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@sss.pgh.pa.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@sss.pgh.pa.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


pgsql-performance by date:

Previous
From: Matheus de Oliveira
Date:
Subject: Re: Avoiding Refreezing XIDs Repeatedly
Next
From: David G Johnston
Date:
Subject: Re: Migrating a FoxPro system and would like input on the best way to achieve optimal performance