Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6cdc26e

Browse files
committed
Doc: small improvements for documentation about VACUUM freezing.
Mostly, explain how row xmin's used to be replaced by FrozenTransactionIdand no longer are. Do a little copy-editing on the side.Per discussion with Egor Rogov. Back-patch to 9.4 where the behavioralchange occurred.Discussion: <575D7955.6060209@postgrespro.ru>
1 parent0ce0801 commit6cdc26e

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

‎doc/src/sgml/maintenance.sgml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@
386386
</indexterm>
387387

388388
<para>
389-
<productname>PostgreSQL</productname>'s MVCC transaction semantics
389+
<productname>PostgreSQL</productname>'s
390+
<link linkend="mvcc-intro">MVCC</link> transaction semantics
390391
depend on being able to compare transaction ID (<acronym>XID</>)
391392
numbers: a row version with an insertion XID greater than the current
392393
transaction's XID is <quote>in the future</> and should not be visible
@@ -404,13 +405,10 @@
404405
<para>
405406
The reason that periodic vacuuming solves the problem is that
406407
<command>VACUUM</> will mark rows as <emphasis>frozen</>, indicating that
407-
they were inserted by a transaction which committed sufficiently far in
408-
the past that the effects of the inserting transaction is certain to be
409-
visible, from an MVCC perspective, to all current and future transactions.
410-
<productname>PostgreSQL</> reserves a special XID,
411-
<literal>FrozenTransactionId</>, which does not follow the normal XID
412-
comparison rules and is always considered older
413-
than every normal XID. Normal XIDs are
408+
they were inserted by a transaction that committed sufficiently far in
409+
the past that the effects of the inserting transaction are certain to be
410+
visible to all current and future transactions.
411+
Normal XIDs are
414412
compared using modulo-2<superscript>32</> arithmetic. This means
415413
that for every normal XID, there are two billion XIDs that are
416414
<quote>older</> and two billion that are <quote>newer</>; another
@@ -420,16 +418,40 @@
420418
the next two billion transactions, no matter which normal XID we are
421419
talking about. If the row version still exists after more than two billion
422420
transactions, it will suddenly appear to be in the future. To
423-
prevent this, frozen row versions are treated as if the inserting XID were
421+
prevent this, <productname>PostgreSQL</> reserves a special XID,
422+
<literal>FrozenTransactionId</>, which does not follow the normal XID
423+
comparison rules and is always considered older
424+
than every normal XID.
425+
Frozen row versions are treated as if the inserting XID were
424426
<literal>FrozenTransactionId</>, so that they will appear to be
425427
<quote>in the past</> to all normal transactions regardless of wraparound
426428
issues, and so such row versions will be valid until deleted, no matter
427429
how long that is.
428430
</para>
429431

432+
<note>
433+
<para>
434+
In <productname>PostgreSQL</> versions before 9.4, freezing was
435+
implemented by actually replacing a row's insertion XID
436+
with <literal>FrozenTransactionId</>, which was visible in the
437+
row's <structname>xmin</> system column. Newer versions just set a flag
438+
bit, preserving the row's original <structname>xmin</> for possible
439+
forensic use. However, rows with <structname>xmin</> equal
440+
to <literal>FrozenTransactionId</> (2) may still be found
441+
in databases <application>pg_upgrade</>'d from pre-9.4 versions.
442+
</para>
443+
<para>
444+
Also, system catalogs may contain rows with <structname>xmin</> equal
445+
to <literal>BootstrapTransactionId</> (1), indicating that they were
446+
inserted during the first phase of <application>initdb</>.
447+
Like <literal>FrozenTransactionId</>, this special XID is treated as
448+
older than every normal XID.
449+
</para>
450+
</note>
451+
430452
<para>
431453
<xref linkend="guc-vacuum-freeze-min-age">
432-
controls how old an XID value has to be beforeits row version will be
454+
controls how old an XID value has to be beforerows bearing that XID will be
433455
frozen. Increasing this setting may avoid unnecessary work if the
434456
rows that would otherwise be frozen will soon be modified again,
435457
but decreasing this setting increases

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp