From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Optimization of the alignment padding |
Date: | 2005-11-15 18:21:45 |
Message-ID: | 200511151821.jAFILjG15105@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
There is a long TODO about it:
* Merge xmin/xmax/cmin/cmax back into three header fields
Before subtransactions, there used to be only three fields needed to
store these four values. This was possible because only the current
transaction looks at the cmin/cmax values. If the current transaction
created and expired the row the fields stored where xmin (same as
xmax), cmin, cmax, and if the transaction was expiring a row from a
another transaction, the fields stored were xmin (cmin was not
needed), xmax, and cmax. Such a system worked because a transaction
could only see rows from another completed transaction. However,
subtransactions can see rows from outer transactions, and once the
subtransaction completes, the outer transaction continues, requiring
the storage of all four fields. With subtransactions, an outer
transaction can create a row, a subtransaction expire it, and when the
subtransaction completes, the outer transaction still has to have
proper visibility of the row's cmin, for example, for cursors.
One possible solution is to create a phantom cid which represents a
cmin/cmax pair and is stored in local memory. Another idea is to
store both cmin and cmax only in local memory.
As mentioned before, this saves four bytes in all cases.
---------------------------------------------------------------------------
Alvaro Herrera wrote:
> ITAGAKI Takahiro wrote:
>
> > After the subtransaction had been added,
> > the size of HeapTupleHeader became 27 bytes.
> > This consumes extra bytes per tuple for the alignment padding,
> > especially on systems where MAXIMUM_ALIGNOF is 8.
>
> There was a discussion during the 8.1 devel cycle about shortening the
> HeapTupleHeader struct. It involved some games with the command Ids.
> Maybe you'll want to look at that, as it could have an impact on what
> you're trying to do here. It reduced the size of the header by 4 bytes.
>
> There was even a detailed design posted by Tom, I see you were copied on
> it:
>
>
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
> Cc: "Jim C. Nasby" <jnasby(at)pervasive(dot)com>,
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>,
> ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp>,
> pgsql-hackers(at)postgresql(dot)org, mkoi-pg(at)aon(dot)at
> Date: Wed, 07 Sep 2005 13:38:07 -0400
> Subject: Re: [HACKERS] Remove xmin and cmin from frozen tuples
>
> --
> Alvaro Herrera http://www.CommandPrompt.com/
> The PostgreSQL Company - Command Prompt, Inc.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2005-11-15 18:27:10 | Re: MERGE vs REPLACE |
Previous Message | Bruce Momjian | 2005-11-15 18:11:16 | Re: compiling on windows with mingw |