Re: Add 64-bit XIDs into PostgreSQL 15

From: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
To: Maxim Orlov <orlovmg(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add 64-bit XIDs into PostgreSQL 15
Date: 2022-01-05 18:00:05
Message-ID: CANbhV-HXc21-f0X5xiNLQL5ELoEHJQNchJ6086E3rLnHxGqTaw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 30 Dec 2021 at 13:19, Maxim Orlov <orlovmg(at)gmail(dot)com> wrote:
>
> Hi, hackers!
>
> Long time wraparound was a really big pain for highly loaded systems. One source of performance degradation is the need to vacuum before every wraparound.
> And there were several proposals to make XIDs 64-bit like [1], [2], [3] and [4] to name a few.

Very good to see this revived.

> PFA updated working patch v6 for PG15 development cycle.
> It is based on a patch by Alexander Korotkov version 5 [5] with a few fixes, refactoring and was rebased to PG15.
>
> Main changes:
> - Change TransactionId to 64bit

This sounds like a good route to me.

> - Disk tuple format (HeapTupleHeader) is unchanged: xmin and xmax
> remains 32bit
> -- 32bit xid is named ShortTransactionId now.
> -- Exception: see "double xmax" format below.
> - Heap page format is changed to contain xid and multixact base value,
> tuple's xmin and xmax are offsets from.
> -- xid_base and multi_base are stored as a page special data. PageHeader
> remains unmodified.
> -- If after upgrade page has no free space for special data, tuples are
> converted to "double xmax" format: xmin became virtual
> FrozenTransactionId, xmax occupies the whole 64bit.
> Page converted to new format when vacuum frees enough space.
> - In-memory tuples (HeapTuple) were enriched with copies of xid_base and
> multi_base from a page.

I think we need more Overview of Behavior than is available with this
patch, perhaps in the form of a README, such as in
src/backend/access/heap/README.HOT.

Most people's comments are about what the opportunities and problems
caused, and mine are definitely there also. i.e. explain the user
visible behavior.
Please explain the various new states that pages can be in and what
the effects are,

My understanding is this would be backwards compatible, so we can
upgrade to it. Please confirm.

Thanks

--
Simon Riggs http://www.EnterpriseDB.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhihong Yu 2022-01-05 18:16:48 Re: [Proposal] Add foreign-server health checks infrastructure
Previous Message Andres Freund 2022-01-05 17:46:43 Re: Throttling WAL inserts when the standby falls behind more than the configured replica_lag_in_bytes