Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > b8f4049de69feba5041d49ed4382e582 > files > 250

postgresql-docs-8.0.11-0.1.20060mdk.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Routine Database Maintenance Tasks</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 8.0.11 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Server Administration"
HREF="admin.html"><LINK
REL="PREVIOUS"
TITLE="Character Set Support"
HREF="multibyte.html"><LINK
REL="NEXT"
TITLE="Routine Reindexing"
HREF="routine-reindex.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2007-02-02T03:57:22"></HEAD
><BODY
CLASS="CHAPTER"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
>PostgreSQL 8.0.11 Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="multibyte.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="charset.html"
>Fast Backward</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="backup.html"
>Fast Forward</A
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="routine-reindex.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="MAINTENANCE"
></A
>Chapter 21. Routine Database Maintenance Tasks</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>21.1. <A
HREF="maintenance.html#ROUTINE-VACUUMING"
>Routine Vacuuming</A
></DT
><DD
><DL
><DT
>21.1.1. <A
HREF="maintenance.html#VACUUM-FOR-SPACE-RECOVERY"
>Recovering disk space</A
></DT
><DT
>21.1.2. <A
HREF="maintenance.html#VACUUM-FOR-STATISTICS"
>Updating planner statistics</A
></DT
><DT
>21.1.3. <A
HREF="maintenance.html#VACUUM-FOR-WRAPAROUND"
>Preventing transaction ID wraparound failures</A
></DT
></DL
></DD
><DT
>21.2. <A
HREF="routine-reindex.html"
>Routine Reindexing</A
></DT
><DT
>21.3. <A
HREF="logfile-maintenance.html"
>Log File Maintenance</A
></DT
></DL
></DIV
><A
NAME="AEN21035"
></A
><P
>   There are a few routine maintenance chores that must be performed on
   a regular basis to keep a <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>
   server running smoothly.  The tasks discussed here are repetitive
   in nature and can easily be automated using standard Unix tools such
   as <SPAN
CLASS="APPLICATION"
>cron</SPAN
> scripts.  But it is the database
   administrator's responsibility to set up appropriate scripts, and to
   check that they execute successfully.
  </P
><P
>   One obvious maintenance task is creation of backup copies of the data on a
   regular schedule.  Without a recent backup, you have no chance of recovery
   after a catastrophe (disk failure, fire, mistakenly dropping a critical
   table, etc.).  The backup and recovery mechanisms available in
   <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> are discussed at length in
   <A
HREF="backup.html"
>Chapter 22</A
>.
  </P
><P
>   The other main category of maintenance task is periodic <SPAN
CLASS="QUOTE"
>"vacuuming"</SPAN
>
   of the database.  This activity is discussed in
   <A
HREF="maintenance.html#ROUTINE-VACUUMING"
>Section 21.1</A
>.
  </P
><P
>   Something else that might need periodic attention is log file management.
   This is discussed in <A
HREF="logfile-maintenance.html"
>Section 21.3</A
>.
  </P
><P
>   <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> is low-maintenance compared
   to some other database management systems.  Nonetheless,
   appropriate attention to these tasks will go far towards ensuring a
   pleasant and productive experience with the system.
  </P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="ROUTINE-VACUUMING"
>21.1. Routine Vacuuming</A
></H1
><A
NAME="AEN21052"
></A
><P
>   <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>'s <TT
CLASS="COMMAND"
>VACUUM</TT
> command
   must be run on a regular basis for several reasons:

    <P
></P
></P><OL
TYPE="1"
><LI
><P
>To recover disk space occupied by updated or deleted
      rows.</P
></LI
><LI
><P
>To update data statistics used by the
      <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> query planner.</P
></LI
><LI
><P
>To protect against loss of very old data due to
      <I
CLASS="FIRSTTERM"
>transaction ID wraparound</I
>.</P
></LI
></OL
><P>

   The frequency and scope of the <TT
CLASS="COMMAND"
>VACUUM</TT
> operations performed for each of
   these reasons will vary depending on the needs of each site.
   Therefore, database administrators must understand these issues and
   develop an appropriate maintenance strategy.  This section concentrates
   on explaining the high-level issues; for details about command syntax
   and so on, see the <A
HREF="sql-vacuum.html"
>VACUUM</A
> reference page.
  </P
><P
>   Beginning in <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 7.2, the standard form
   of <TT
CLASS="COMMAND"
>VACUUM</TT
> can run in parallel with normal database operations
   (selects, inserts, updates, deletes, but not changes to table definitions).
   Routine vacuuming is therefore not nearly as intrusive as it was in prior
   releases, and it is not as critical to try to schedule it at low-usage
   times of day.
  </P
><P
>   Beginning in <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 8.0, there are
   configuration parameters that can be adjusted to further reduce the
   performance impact of background vacuuming.  See
   <A
HREF="runtime-config.html#RUNTIME-CONFIG-RESOURCE-VACUUM-COST"
>Section 16.4.3.4</A
>.
  </P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="VACUUM-FOR-SPACE-RECOVERY"
>21.1.1. Recovering disk space</A
></H2
><A
NAME="AEN21076"
></A
><P
>    In normal <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> operation, an
    <TT
CLASS="COMMAND"
>UPDATE</TT
> or <TT
CLASS="COMMAND"
>DELETE</TT
> of a row does not
    immediately remove the old version of the row.
    This approach is necessary to gain the benefits of multiversion
    concurrency control (see <A
HREF="mvcc.html"
>Chapter 12</A
>): the row version
    must not be deleted while it is still potentially visible to other
    transactions. But eventually, an outdated or deleted row version is no
    longer of interest to any transaction. The space it occupies must be
    reclaimed for reuse by new rows, to avoid infinite growth of disk
    space requirements. This is done by running <TT
CLASS="COMMAND"
>VACUUM</TT
>.
   </P
><P
>    Clearly, a table that receives frequent updates or deletes will need
    to be vacuumed more often than tables that are seldom updated. It
    may be useful to set up periodic <SPAN
CLASS="APPLICATION"
>cron</SPAN
> tasks that
    <TT
CLASS="COMMAND"
>VACUUM</TT
> only selected tables, skipping tables that are known not to
    change often. This is only likely to be helpful if you have both
    large heavily-updated tables and large seldom-updated tables &mdash; the
    extra cost of vacuuming a small table isn't enough to be worth
    worrying about.
   </P
><P
>    There are two variants of the <TT
CLASS="COMMAND"
>VACUUM</TT
>
    command. The first form, known as <SPAN
CLASS="QUOTE"
>"lazy vacuum"</SPAN
> or
    just <TT
CLASS="COMMAND"
>VACUUM</TT
>, marks expired data in tables and
    indexes for future reuse; it does <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not</I
></SPAN
> attempt
    to reclaim the space used by this expired data
    immediately. Therefore, the table file is not shortened, and any
    unused space in the file is not returned to the operating
    system. This variant of <TT
CLASS="COMMAND"
>VACUUM</TT
> can be run
    concurrently with normal database operations.
   </P
><P
>    The second form is the <TT
CLASS="COMMAND"
>VACUUM FULL</TT
>
    command. This uses a more aggressive algorithm for reclaiming the
    space consumed by expired row versions. Any space that is freed by
    <TT
CLASS="COMMAND"
>VACUUM FULL</TT
> is immediately returned to the
    operating system. Unfortunately, this variant of the
    <TT
CLASS="COMMAND"
>VACUUM</TT
> command acquires an exclusive lock on
    each table while <TT
CLASS="COMMAND"
>VACUUM FULL</TT
> is processing
    it. Therefore, frequently using <TT
CLASS="COMMAND"
>VACUUM FULL</TT
> can
    have an extremely negative effect on the performance of concurrent
    database queries.
   </P
><P
>    The standard form of <TT
CLASS="COMMAND"
>VACUUM</TT
> is best used with the goal
    of maintaining a fairly level steady-state usage of disk space. If
    you need to return disk space to the operating system you can use
    <TT
CLASS="COMMAND"
>VACUUM FULL</TT
> &mdash; but what's the point of releasing disk
    space that will only have to be allocated again soon?  Moderately
    frequent standard <TT
CLASS="COMMAND"
>VACUUM</TT
> runs are a better approach
    than infrequent <TT
CLASS="COMMAND"
>VACUUM FULL</TT
> runs for maintaining
    heavily-updated tables.
   </P
><P
>    Recommended practice for most sites is to schedule a database-wide
    <TT
CLASS="COMMAND"
>VACUUM</TT
> once a day at a low-usage time of day,
    supplemented by more frequent vacuuming of heavily-updated tables
    if necessary. (Some installations with an extremely high
    rate of data modification <TT
CLASS="COMMAND"
>VACUUM</TT
> busy tables as
    often as once every few minutes.)  If you have multiple databases
    in a cluster, don't forget to <TT
CLASS="COMMAND"
>VACUUM</TT
> each one;
    the program <TT
CLASS="FILENAME"
>vacuumdb</TT
> may be helpful.
   </P
><DIV
CLASS="TIP"
><BLOCKQUOTE
CLASS="TIP"
><P
><B
>Tip: </B
>     The <TT
CLASS="FILENAME"
>contrib/pg_autovacuum</TT
> program can be useful for
     automating high-frequency vacuuming operations.
    </P
></BLOCKQUOTE
></DIV
><P
>    <TT
CLASS="COMMAND"
>VACUUM FULL</TT
> is recommended for cases where you know
    you have deleted the majority of rows in a table, so that the
    steady-state size of the table can be shrunk substantially with
    <TT
CLASS="COMMAND"
>VACUUM FULL</TT
>'s more aggressive approach.  Use plain
    <TT
CLASS="COMMAND"
>VACUUM</TT
>, not <TT
CLASS="COMMAND"
>VACUUM FULL</TT
>, for routine
    vacuuming for space recovery.
   </P
><P
>    If you have a table whose contents are deleted on a periodic
    basis, consider doing it with <TT
CLASS="COMMAND"
>TRUNCATE</TT
> rather
    than using <TT
CLASS="COMMAND"
>DELETE</TT
> followed by
    <TT
CLASS="COMMAND"
>VACUUM</TT
>. <TT
CLASS="COMMAND"
>TRUNCATE</TT
> removes the
    entire content of the table immediately, without requiring a
    subsequent <TT
CLASS="COMMAND"
>VACUUM</TT
> or <TT
CLASS="COMMAND"
>VACUUM
    FULL</TT
> to reclaim the now-unused disk space.
   </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="VACUUM-FOR-STATISTICS"
>21.1.2. Updating planner statistics</A
></H2
><A
NAME="AEN21126"
></A
><A
NAME="AEN21129"
></A
><P
>    The <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> query planner relies on
    statistical information about the contents of tables in order to
    generate good plans for queries.  These statistics are gathered by
    the <TT
CLASS="COMMAND"
>ANALYZE</TT
> command, which can be invoked by itself or
    as an optional step in <TT
CLASS="COMMAND"
>VACUUM</TT
>.  It is important to have
    reasonably accurate statistics, otherwise poor choices of plans may
    degrade database performance.
   </P
><P
>    As with vacuuming for space recovery, frequent updates of statistics
    are more useful for heavily-updated tables than for seldom-updated
    ones. But even for a heavily-updated table, there may be no need for
    statistics updates if the statistical distribution of the data is
    not changing much. A simple rule of thumb is to think about how much
    the minimum and maximum values of the columns in the table change.
    For example, a <TT
CLASS="TYPE"
>timestamp</TT
> column that contains the time
    of row update will have a constantly-increasing maximum value as
    rows are added and updated; such a column will probably need more
    frequent statistics updates than, say, a column containing URLs for
    pages accessed on a website. The URL column may receive changes just
    as often, but the statistical distribution of its values probably
    changes relatively slowly.
   </P
><P
>    It is possible to run <TT
CLASS="COMMAND"
>ANALYZE</TT
> on specific tables and even
    just specific columns of a table, so the flexibility exists to update some
    statistics more frequently than others if your application requires it.
    In practice, however, the usefulness of this feature is doubtful.
    Beginning in <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 7.2,
    <TT
CLASS="COMMAND"
>ANALYZE</TT
> is a fairly fast operation even on large tables,
    because it uses a statistical random sampling of the rows of a table
    rather than reading every single row.  So it's probably much simpler
    to just run it over the whole database every so often.
   </P
><DIV
CLASS="TIP"
><BLOCKQUOTE
CLASS="TIP"
><P
><B
>Tip: </B
>     Although per-column tweaking of <TT
CLASS="COMMAND"
>ANALYZE</TT
> frequency may not be
     very productive, you may well find it worthwhile to do per-column
     adjustment of the level of detail of the statistics collected by
     <TT
CLASS="COMMAND"
>ANALYZE</TT
>.  Columns that are heavily used in <TT
CLASS="LITERAL"
>WHERE</TT
> clauses
     and have highly irregular data distributions may require a finer-grain
     data histogram than other columns.  See <TT
CLASS="COMMAND"
>ALTER TABLE SET
     STATISTICS</TT
>.
    </P
></BLOCKQUOTE
></DIV
><P
>    Recommended practice for most sites is to schedule a database-wide
    <TT
CLASS="COMMAND"
>ANALYZE</TT
> once a day at a low-usage time of day; this can
    usefully be combined with a nightly <TT
CLASS="COMMAND"
>VACUUM</TT
>.  However,
    sites with relatively slowly changing table statistics may find that
    this is overkill, and that less-frequent <TT
CLASS="COMMAND"
>ANALYZE</TT
> runs
    are sufficient.
   </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="VACUUM-FOR-WRAPAROUND"
>21.1.3. Preventing transaction ID wraparound failures</A
></H2
><A
NAME="AEN21153"
></A
><P
>    <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
>'s MVCC transaction semantics
    depend on being able to compare transaction ID (<ACRONYM
CLASS="ACRONYM"
>XID</ACRONYM
>)
    numbers: a row version with an insertion XID greater than the current
    transaction's XID is <SPAN
CLASS="QUOTE"
>"in the future"</SPAN
> and should not be visible
    to the current transaction.  But since transaction IDs have limited size
    (32 bits at this writing) a cluster that runs for a long time (more
    than 4 billion transactions) will suffer <I
CLASS="FIRSTTERM"
>transaction ID
    wraparound</I
>: the XID counter wraps around to zero, and all of a sudden
    transactions that were in the past appear to be in the future &mdash; which
    means their outputs become invisible.  In short, catastrophic data loss.
    (Actually the data is still there, but that's cold comfort if you can't
    get at it.)
   </P
><P
>    Prior to <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 7.2, the only defense
    against XID wraparound was to re-<TT
CLASS="COMMAND"
>initdb</TT
> at least every 4
    billion transactions. This of course was not very satisfactory for
    high-traffic sites, so a better solution has been devised. The new
    approach allows a server to remain up indefinitely, without
    <TT
CLASS="COMMAND"
>initdb</TT
> or any sort of restart. The price is this
    maintenance requirement: <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>every table in the database must
    be vacuumed at least once every billion transactions</I
></SPAN
>.
   </P
><P
>    In practice this isn't an onerous requirement, but since the
    consequences of failing to meet it can be complete data loss (not
    just wasted disk space or slow performance), some special provisions
    have been made to help database administrators keep track of the
    time since the last <TT
CLASS="COMMAND"
>VACUUM</TT
>. The remainder of this
    section gives the details.
   </P
><P
>    The new approach to XID comparison distinguishes two special XIDs,
    numbers 1 and 2 (<TT
CLASS="LITERAL"
>BootstrapXID</TT
> and
    <TT
CLASS="LITERAL"
>FrozenXID</TT
>). These two XIDs are always considered older
    than every normal XID. Normal XIDs (those greater than 2) are
    compared using modulo-2<SUP
>31</SUP
> arithmetic. This means
    that for every normal XID, there are two billion XIDs that are
    <SPAN
CLASS="QUOTE"
>"older"</SPAN
> and two billion that are <SPAN
CLASS="QUOTE"
>"newer"</SPAN
>; another
    way to say it is that the normal XID space is circular with no
    endpoint. Therefore, once a row version has been created with a particular
    normal XID, the row version will appear to be <SPAN
CLASS="QUOTE"
>"in the past"</SPAN
> for
    the next two billion transactions, no matter which normal XID we are
    talking about. If the row version still exists after more than two billion
    transactions, it will suddenly appear to be in the future. To
    prevent data loss, old row versions must be reassigned the XID
    <TT
CLASS="LITERAL"
>FrozenXID</TT
> sometime before they reach the
    two-billion-transactions-old mark. Once they are assigned this
    special XID, they will appear to be <SPAN
CLASS="QUOTE"
>"in the past"</SPAN
> to all
    normal transactions regardless of wraparound issues, and so such
    row versions will be good until deleted, no matter how long that is. This
    reassignment of XID is handled by <TT
CLASS="COMMAND"
>VACUUM</TT
>.
   </P
><P
>    <TT
CLASS="COMMAND"
>VACUUM</TT
>'s normal policy is to reassign <TT
CLASS="LITERAL"
>FrozenXID</TT
>
    to any row version with a normal XID more than one billion transactions in the
    past.  This policy preserves the original insertion XID until it is not
    likely to be of interest anymore.  (In fact, most row versions will probably
    live and die without ever being <SPAN
CLASS="QUOTE"
>"frozen"</SPAN
>.)  With this policy,
    the maximum safe interval between <TT
CLASS="COMMAND"
>VACUUM</TT
> runs on any table
    is exactly one billion transactions: if you wait longer, it's possible
    that a row version that was not quite old enough to be reassigned last time
    is now more than two billion transactions old and has wrapped around
    into the future &mdash; i.e., is lost to you.  (Of course, it'll reappear
    after another two billion transactions, but that's no help.)
   </P
><P
>    Since periodic <TT
CLASS="COMMAND"
>VACUUM</TT
> runs are needed anyway for the reasons
    described earlier, it's unlikely that any table would not be vacuumed
    for as long as a billion transactions.  But to help administrators ensure
    this constraint is met, <TT
CLASS="COMMAND"
>VACUUM</TT
> stores transaction ID
    statistics in the system table <TT
CLASS="LITERAL"
>pg_database</TT
>.  In particular,
    the <TT
CLASS="LITERAL"
>datfrozenxid</TT
> column of a database's
    <TT
CLASS="LITERAL"
>pg_database</TT
> row is updated at the completion of any
    database-wide <TT
CLASS="COMMAND"
>VACUUM</TT
> operation (i.e., <TT
CLASS="COMMAND"
>VACUUM</TT
> that does not
    name a specific table).  The value stored in this field is the freeze
    cutoff XID that was used by that <TT
CLASS="COMMAND"
>VACUUM</TT
> command.  All normal
    XIDs older than this cutoff XID are guaranteed to have been replaced by
    <TT
CLASS="LITERAL"
>FrozenXID</TT
> within that database.  A convenient way to
    examine this information is to execute the query

</P><PRE
CLASS="PROGRAMLISTING"
>SELECT datname, age(datfrozenxid) FROM pg_database;</PRE
><P>

    The <TT
CLASS="LITERAL"
>age</TT
> column measures the number of transactions from the
    cutoff XID to the current transaction's XID.
   </P
><P
>    With the standard freezing policy, the <TT
CLASS="LITERAL"
>age</TT
> column will start
    at one billion for a freshly-vacuumed database.  When the <TT
CLASS="LITERAL"
>age</TT
>
    approaches two billion, the database must be vacuumed again to avoid
    risk of wraparound failures.  Recommended practice is to <TT
CLASS="COMMAND"
>VACUUM</TT
> each
    database at least once every half-a-billion (500 million) transactions,
    so as to provide plenty of safety margin.  To help meet this rule,
    each database-wide <TT
CLASS="COMMAND"
>VACUUM</TT
> automatically delivers a warning
    if there are any <TT
CLASS="LITERAL"
>pg_database</TT
> entries showing an
    <TT
CLASS="LITERAL"
>age</TT
> of more than 1.5 billion transactions, for example:

</P><PRE
CLASS="PROGRAMLISTING"
>play=# VACUUM;
WARNING:  some databases have not been vacuumed in 1613770184 transactions
HINT:  Better vacuum them within 533713463 transactions, or you may have a wraparound failure.
VACUUM</PRE
><P>
   </P
><P
>    <TT
CLASS="COMMAND"
>VACUUM</TT
> with the <TT
CLASS="COMMAND"
>FREEZE</TT
> option uses a more
    aggressive freezing policy: row versions are frozen if they are old enough
    to be considered good by all open transactions. In particular, if a
    <TT
CLASS="COMMAND"
>VACUUM FREEZE</TT
> is performed in an otherwise-idle
    database, it is guaranteed that <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>all</I
></SPAN
> row versions in that
    database will be frozen. Hence, as long as the database is not
    modified in any way, it will not need subsequent vacuuming to avoid
    transaction ID wraparound problems. This technique is used by
    <TT
CLASS="COMMAND"
>initdb</TT
> to prepare the <TT
CLASS="LITERAL"
>template0</TT
> database.
    It should also be used to prepare any user-created databases that
    are to be marked <TT
CLASS="LITERAL"
>datallowconn</TT
> = <TT
CLASS="LITERAL"
>false</TT
> in
    <TT
CLASS="LITERAL"
>pg_database</TT
>, since there isn't any convenient way to
    <TT
CLASS="COMMAND"
>VACUUM</TT
> a database that you can't connect to. Note that
    <TT
CLASS="COMMAND"
>VACUUM</TT
>'s automatic warning message about
    unvacuumed databases will ignore <TT
CLASS="LITERAL"
>pg_database</TT
> entries
    with <TT
CLASS="LITERAL"
>datallowconn</TT
> = <TT
CLASS="LITERAL"
>false</TT
>, so as to avoid
    giving false warnings about these databases; therefore it's up to
    you to ensure that such databases are frozen correctly.
   </P
><DIV
CLASS="WARNING"
><P
></P
><TABLE
CLASS="WARNING"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Warning</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>     To be sure of safety against transaction wraparound, it is necessary
     to vacuum <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>every</I
></SPAN
> table, including system catalogs, in
     <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>every</I
></SPAN
> database at least once every billion transactions.
     We have seen data loss situations caused by people deciding that they
     only needed to vacuum their active user tables, rather than issuing
     database-wide vacuum commands.  That will appear to work fine ...
     for a while.
    </P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="multibyte.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="routine-reindex.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Character Set Support</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="admin.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Routine Reindexing</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>