Re: 64 bit transaction id

From: Павел Ерёмин <shnoor111gmail(at)yandex(dot)ru>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 64 bit transaction id
Date: 2019-11-02 20:35:09
Message-ID: 2428111572726909@sas2-7fadb031fd9b.qloud-c.yandex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

<div><div>The proposed option is not much different from what it is now.</div><div>We are not trying to save some space - we will reuse the existing one. We just work in 64 bit transaction counters. Correct me if I'm wrong - the address of the next version of the line is stored in the 6 byte field t_cid in the tuple header - which is not attached to the current page in any way - and can be stored anywhere in the table. Nothing changes.</div><div>I often explain things very poorly, but I will try.</div><div>for example</div><div>Each transaction is assigned a unique 64-bit xid.</div><div>In the tuple header, we replace 32-bit xmin and xmax - with one 64-bit field - let's call it xid.</div><div>Suppose</div><div>Transaction 1 does INSERT</div><div>The first version is created (Tuple1).</div><div>Tuple1. Tuple_header.xid = Transacrion1.xid and Tuple1. Tuple_header. t_cid = 0;</div><div>Transaction 3 (started after transaction 1) does UPDATE</div><div>The second version is created (Tuple2).</div><div>Tuple1. Tuple_header. t_cid = (address) Tuple2;</div><div>Tuple2. Tuple_header.xid = Transacrion3.xid and Tuple2. Tuple_header. t_cid = 0;</div><div>Transaction 2 (started between transaction1 and transaction2) makes SELECT</div><div>Reads Tuple1. Transaction 2 sees that Tuple1.Tuple_header.xid &lt;Transacrion2.xid, sees that the address Tuple1 is filled. Tuple_header. t_cid, follow it and read the version of Tuple2.</div></div><div><br /></div><div><br /></div><div>02.11.2019, 21:15, "Tomas Vondra" &lt;tomas(dot)vondra(at)2ndquadrant(dot)com&gt;:</div><blockquote><p>On Sat, Nov 02, 2019 at 07:07:17PM +0300, Павел Ерёмин wrote:<br /></p><blockquote class="b4fd5cf2ec92bc68cb898700bb81355fwmi-quote">    <br />   The proposed option does not need to change the length of either the page<br />   header or tuple header. Therefore, you will not need to physically change<br />   the data.<br />    <br /></blockquote><p><br />So how do you link the tuple versions together? Clearly, that has to be<br />stored somewhere ...<br /><br /><br /></p><span class="c18e9d485856a85513717a5a5b59d3fewmi-sign">-- <br />Tomas Vondra <a href="http://www.2ndquadrant.com/">http://www.2ndQuadrant.com</a><br />PostgreSQL Development, 24x7 Support, Remote DBA, Training &amp; Services <br /></span></blockquote>

Attachment Content-Type Size
unknown_filename text/html 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-11-02 20:38:21 Re: dropdb --force
Previous Message Peter Geoghegan 2019-11-02 20:32:08 Re: Index Skip Scan