Skip to content

Commit ec1aafc

Browse files
committed
Document txid functions.
Marko Kreen
1 parent a06ce21 commit ec1aafc

File tree

2 files changed

+91
-12
lines changed

2 files changed

+91
-12
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.212 2007/11/05 12:02:20 darcy Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.213 2007/11/05 14:51:08 momjian Exp $ -->
22

33
<chapter id="datatype">
44
<title id="datatype-title">Data Types</title>
@@ -3437,6 +3437,77 @@ SELECT to_tsquery('Fat:ab & Cats');
34373437

34383438
</sect1>
34393439

3440+
<sect1 id="datatype-txid-snapshot">
3441+
<title>Transaction Snapshot Type</title>
3442+
3443+
<indexterm zone="datatype-txid-snapshot">
3444+
<primary>txid_snapshot</primary>
3445+
</indexterm>
3446+
3447+
<para>
3448+
The data type <type>txid_snapshot</type> stores info about transaction ID
3449+
visibility at a particular moment in time. The components are
3450+
described in <xref linkend="datatype-txid-snapshot-parts">.
3451+
</para>
3452+
3453+
<table id="datatype-txid-snapshot-parts">
3454+
<title>Snapshot components</title>
3455+
<tgroup cols="2">
3456+
<thead>
3457+
<row>
3458+
<entry>Name</entry>
3459+
<entry>Query Function</entry>
3460+
<entry>Description</entry>
3461+
</row>
3462+
</thead>
3463+
3464+
<tbody>
3465+
3466+
<row>
3467+
<entry><type>xmin</type></entry>
3468+
<entry>txid_snapshot_xmin()</entry>
3469+
<entry>
3470+
Earliest transaction ID that is still active. All earlier
3471+
transactions will either be committed and visible, or rolled
3472+
back and dead.
3473+
</entry>
3474+
</row>
3475+
3476+
<row>
3477+
<entry><type>xmax</type></entry>
3478+
<entry>txid_snapshot_xmax()</entry>
3479+
<entry>
3480+
Next unassigned txid. All txids later than this one are
3481+
unassigned, and thus invisible.
3482+
</entry>
3483+
</row>
3484+
3485+
<row>
3486+
<entry><type>xip_list</type></entry>
3487+
<entry>txid_snapshot_xip()</entry>
3488+
<entry>
3489+
Active txids at the time of snapshot. All of them are between
3490+
xmin and xmax. A txid that is <literal>xmin &lt;= txid &lt;
3491+
xmax</literal> and not in this list is visible.
3492+
</entry>
3493+
</row>
3494+
3495+
</tbody>
3496+
</tgroup>
3497+
</table>
3498+
3499+
<para>
3500+
Snapshot's textual representation is <literal>[xmin]:[xmax]:[xip_list]</literal>
3501+
for example <literal>10:20:10,14,15</literal> means
3502+
<literal>xmin=10 xmax=20 xip_list=10,14,15</literal>.
3503+
</para>
3504+
3505+
<para>
3506+
Functions for getting and querying transaction ids and snapshots are
3507+
described in <xref linkend="functions-txid">.
3508+
</para>
3509+
</sect1>
3510+
34403511
<sect1 id="datatype-uuid">
34413512
<title><acronym>UUID</acronym> Type</title>
34423513

doc/src/sgml/func.sgml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.406 2007/10/30 19:06:56 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.407 2007/11/05 14:51:08 momjian Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -11490,6 +11490,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1149011490
as well.
1149111491
</para>
1149211492

11493+
</sect1>
11494+
11495+
<sect1 id="functions-txid">
11496+
<title>Transaction ID and Snapshot Functions</title>
11497+
1149311498
<indexterm>
1149411499
<primary>txid_current</primary>
1149511500
</indexterm>
@@ -11562,20 +11567,23 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1156211567
</table>
1156311568

1156411569
<para>
11565-
The internal transaction ID type (<type>xid</>) is 32 bits wide and so
11566-
it wraps around every 4 billion transactions. However, these functions
11567-
export a 64-bit format that is extended with an <quote>epoch</> counter
11568-
so that it will not wrap around for the life of an installation.
11570+
The internal transaction ID type (<type>xid</>) is 32 bits wide and
11571+
so it wraps around every 4 billion transactions. However, these
11572+
functions export a 64-bit format that is extended with an
11573+
<quote>epoch</> counter so that it will not wrap around for the life
11574+
of an installation. The main use of these functions is to determine
11575+
which transactions were committed between two snapshots.
1156911576
</para>
11577+
1157011578
</sect1>
1157111579

11572-
<sect1 id="functions-admin">
11573-
<title>System Administration Functions</title>
11580+
<sect1 id="functions-admin">
11581+
<title>System Administration Functions</title>
1157411582

11575-
<para>
11576-
<xref linkend="functions-admin-set-table"> shows the functions
11577-
available to query and alter run-time configuration parameters.
11578-
</para>
11583+
<para>
11584+
<xref linkend="functions-admin-set-table"> shows the functions
11585+
available to query and alter run-time configuration parameters.
11586+
</para>
1157911587

1158011588
<table id="functions-admin-set-table">
1158111589
<title>Configuration Settings Functions</title>

0 commit comments

Comments
 (0)