1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-30 06:01:21 +03:00

Keep track of transaction commit timestamps

Transactions can now set their commit timestamp directly as they commit,
or an external transaction commit timestamp can be fed from an outside
system using the new function TransactionTreeSetCommitTsData().  This
data is crash-safe, and truncated at Xid freeze point, same as pg_clog.

This module is disabled by default because it causes a performance hit,
but can be enabled in postgresql.conf requiring only a server restart.

A new test in src/test/modules is included.

Catalog version bumped due to the new subdirectory within PGDATA and a
couple of new SQL functions.

Authors: Álvaro Herrera and Petr Jelínek

Reviewed to varying degrees by Michael Paquier, Andres Freund, Robert
Haas, Amit Kapila, Fujii Masao, Jaime Casanova, Simon Riggs, Steven
Singer, Peter Eisentraut
This commit is contained in:
Alvaro Herrera
2014-12-03 11:53:02 -03:00
parent 6597ec9be6
commit 73c986adde
43 changed files with 1458 additions and 28 deletions

View File

@@ -15938,6 +15938,45 @@ SELECT collation for ('foo' COLLATE "de_DE");
For example <literal>10:20:10,14,15</literal> means
<literal>xmin=10, xmax=20, xip_list=10, 14, 15</literal>.
</para>
<para>
The functions shown in <xref linkend="functions-commit-timestamp">
provide information about transactions that have been already committed.
These functions mainly provide information about when the transactions
were committed. They only provide useful data when
<xref linkend="guc-track-commit-timestamp"> configuration option is enabled
and only for transactions that were committed after it was enabled.
</para>
<table id="functions-commit-timestamp">
<title>Committed transaction information</title>
<tgroup cols="3">
<thead>
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry></row>
</thead>
<tbody>
<row>
<entry>
<indexterm><primary>pg_xact_commit_timestamp</primary></indexterm>
<literal><function>pg_xact_commit_timestamp(<parameter>xid</parameter>)</function></literal>
</entry>
<entry><type>timestamp with time zone</type></entry>
<entry>get commit timestamp of a transaction</entry>
</row>
<row>
<entry>
<indexterm><primary>pg_last_committed_xact</primary></indexterm>
<literal><function>pg_last_committed_xact()</function></literal>
</entry>
<entry><parameter>xid</> <type>xid</>, <parameter>timestamp</> <type>timestamp with time zone</></entry>
<entry>get transaction ID and commit timestamp of latest committed transaction</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="functions-admin">