Re: Freeze avoidance of very large table.

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Petr Jelinek <petr(at)2ndquadrant(dot)com>, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Greg Stark <stark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Subject: Re: Freeze avoidance of very large table.
Date: 2015-04-23 15:48:57
Message-ID: 55391469.5010506@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2015-04-23 15:49:30 Re: Shouldn't CREATE TABLE LIKE copy the relhasoids property?
Previous Message Bruce Momjian 2015-04-23 15:45:32 Re: Freeze avoidance of very large table.