Re: Freeze avoidance of very large table. - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Freeze avoidance of very large table.
Date
Msg-id 55391469.5010506@iki.fi
Whole thread Raw
In response to Re: Freeze avoidance of very large table.  (Petr Jelinek <petr@2ndquadrant.com>)
List pgsql-hackers
On 04/23/2015 06:39 PM, Petr Jelinek wrote:
> On 23/04/15 17:24, Heikki Linnakangas wrote:
>> On 04/23/2015 05:52 PM, Jim Nasby wrote:
>>> I've often wondered if there was some way we could consolidate XMIN/XMAX
>>> from multiple tuples at the page level; that could be a big win for OLAP
>>> environments where most of your tuples belong to a pretty small range of
>>> XIDs. In many workloads you could have 80%+ of the tuples in a table
>>> having a single inserting XID.
>>
>> It would be doable for xmin - IIRC someone even posted a patch for that
>> years ago - but xmax (and ctid) is difficult. When a tuple is inserted,
>> Xmax is basically just a reservation for the value that will be put
>> there later. You have no idea what that value is, and you can't
>> influence it, and when it's time to delete/update the row, you *must*
>> have the space for that xmax. So we can't opportunistically use the
>> space for anything else, or compress them or anything like that.
>
> That depends, if we are going to change page format we can move the xmax
> to be some map of ctid->xmax in the header (with no values for tuples
> with no xmax)  ...

Stop right there. You need to reserve enough space on the page to store 
an xmax for *every* tuple on the page. Because if you don't, what are 
you going to do when every tuple on the page is deleted by a different 
transaction.

Even if you store the xmax somewhere else than the page header, you need 
to reserve the same amount of space for them, so it doesn't help at all.

- Heikki




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Freeze avoidance of very large table.
Next
From: Bruce Momjian
Date:
Subject: Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?