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

Commitd43760b

Browse files
committed
Revise documentation for new freezing method.
Commit37484ad invalidated a goodchunk of documentation, so patch it up to reflect the new state ofplay. Along the way, patch remaining documentation references toFrozenXID to say instead FrozenTransactionId, so that they match theway we actually spell it in the code.
1 parentcf63c64 commitd43760b

File tree

3 files changed

+30
-32
lines changed

3 files changed

+30
-32
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5264,8 +5264,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
52645264
<listitem>
52655265
<para>
52665266
Specifies the cutoff age (in transactions) that <command>VACUUM</>
5267-
should use to decide whether toreplace transaction IDs with
5268-
<literal>FrozenXID</>while scanning a table.
5267+
should use to decide whether tofreeze row versions
5268+
while scanning a table.
52695269
The default is 50 million transactions. Although
52705270
users can set this value anywhere from zero to one billion,
52715271
<command>VACUUM</> will silently limit the effective value to half

‎doc/src/sgml/maintenance.sgml

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,12 @@
397397

398398
<para>
399399
The reason that periodic vacuuming solves the problem is that
400-
<productname>PostgreSQL</productname> reserves a special XID
401-
as <literal>FrozenXID</>. This XID does not follow the normal XID
400+
<command>VACUUM</> will mark rows as <emphasis>frozen</>, indicating that
401+
they were inserted by a transaction which committed sufficiently far in
402+
the past that the effects of the inserting transaction is certain to be
403+
visible, from an MVCC perspective, to all current and future transactions.
404+
<productname>PostgreSQL</> reserves a special XID,
405+
<literal>FrozenTransactionId</>, which does not follow the normal XID
402406
comparison rules and is always considered older
403407
than every normal XID. Normal XIDs are
404408
compared using modulo-2<superscript>32</> arithmetic. This means
@@ -410,29 +414,28 @@
410414
the next two billion transactions, no matter which normal XID we are
411415
talking about. If the row version still exists after more than two billion
412416
transactions, it will suddenly appear to be in the future. To
413-
prevent this, old row versions must be reassigned the XID
414-
<literal>FrozenXID</> sometime before they reach the
415-
two-billion-transactions-old mark. Once they are assigned this
416-
special XID, they will appear to be <quote>in the past</> to all
417-
normal transactions regardless of wraparound issues, and so such
418-
row versions will be valid until deleted, no matter how long that is.
419-
This reassignment of old XIDs is handled by <command>VACUUM</>.
417+
prevent this, frozen row versions are treated as if the inserting XID were
418+
<literal>FrozenTransactionId</>, so that they will appear to be
419+
<quote>in the past</> to all normal transactions regardless of wraparound
420+
issues, and so such row versions will be valid until deleted, no matter
421+
how long that is.
420422
</para>
421423

422424
<para>
423425
<xref linkend="guc-vacuum-freeze-min-age">
424-
controls how old an XID value has to be before it's replaced with
425-
<literal>FrozenXID</>. Larger values of this setting
426-
preserve transactional information longer, while smaller values increase
426+
controls how old an XID value has to be before its row version will be
427+
frozen. Increasing this setting may avoid unnecessary work if the
428+
rows that would otherwise be frozen will soon be modified again,
429+
but decreasing this setting increases
427430
the number of transactions that can elapse before the table must be
428431
vacuumed again.
429432
</para>
430433

431434
<para>
432435
<command>VACUUM</> normally skips pages that don't have any dead row
433436
versions, but those pages might still have row versions with old XID
434-
values. To ensure all oldXIDshave beenreplaced by
435-
<literal>FrozenXID</>, ascan of the whole table is needed.
437+
values. To ensure all oldrow versionshave beenfrozen, a
438+
scan of the whole table is needed.
436439
<xref linkend="guc-vacuum-freeze-table-age"> controls when
437440
<command>VACUUM</> does that: a whole table sweep is forced if
438441
the table hasn't been fully scanned for <varname>vacuum_freeze_table_age</>
@@ -447,8 +450,8 @@
447450
the time <command>VACUUM</> last scanned the whole table. If it were to go
448451
unvacuumed for longer than
449452
that, data loss could result. To ensure that this does not happen,
450-
autovacuum is invoked on any table that might containXIDs older than the
451-
age specified by the configuration parameter <xref
453+
autovacuum is invoked on any table that might containunfrozen rows with
454+
XIDs older than theage specified by the configuration parameter <xref
452455
linkend="guc-autovacuum-freeze-max-age">. (This will happen even if
453456
autovacuum is disabled.)
454457
</para>
@@ -504,30 +507,25 @@
504507

505508
<para>
506509
One disadvantage of decreasing <varname>vacuum_freeze_min_age</> is that
507-
it might cause <command>VACUUM</> to do useless work:changing atablerow's
508-
XID to <literal>FrozenXID</> is a waste of time if the row is modified
510+
it might cause <command>VACUUM</> to do useless work:freezing a row
511+
version is a waste of time if the row is modified
509512
soon thereafter (causing it to acquire a new XID). So the setting should
510513
be large enough that rows are not frozen until they are unlikely to change
511-
any more. Another disadvantage of decreasing this setting is
512-
that details about exactly which transaction inserted or modified a
513-
row will be lost sooner. This information sometimes comes in handy,
514-
particularly when trying to analyze what went wrong after a database
515-
failure. For these two reasons, decreasing this setting is not
516-
recommended except for completely static tables.
514+
any more.
517515
</para>
518516

519517
<para>
520-
To track the age of the oldest XIDs in a database,
518+
To track the age of the oldestunfrozenXIDs in a database,
521519
<command>VACUUM</> stores XID
522520
statistics in the system tables <structname>pg_class</> and
523521
<structname>pg_database</>. In particular,
524522
the <structfield>relfrozenxid</> column of a table's
525523
<structname>pg_class</> row contains the freeze cutoff XID that was used
526-
by the last whole-table <command>VACUUM</> for that table. Allnormal
527-
XIDs older than this cutoff XID are guaranteed to have been replaced by
528-
<literal>FrozenXID</> within the table. Similarly,
524+
by the last whole-table <command>VACUUM</> for that table. Allrows
525+
inserted by transactions withXIDsXIDsolder than this cutoff XID are
526+
guaranteed to have been frozen. Similarly,
529527
the <structfield>datfrozenxid</> column of a database's
530-
<structname>pg_database</> row is a lower bound on thenormal XIDs
528+
<structname>pg_database</> row is a lower bound on theunfrozen XIDs
531529
appearing in that database &mdash; it is just the minimum of the
532530
per-table <structfield>relfrozenxid</> values within the database.
533531
A convenient way to

‎src/backend/access/common/reloptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static relopt_int intRelOpts[] =
182182
{
183183
{
184184
"autovacuum_freeze_table_age",
185-
"Age at which VACUUM should perform a full table sweep toreplace old Xid values with FrozenXID",
185+
"Age at which VACUUM should perform a full table sweep tofreeze row versions",
186186
RELOPT_KIND_HEAP |RELOPT_KIND_TOAST
187187
},-1,0,2000000000
188188
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp