OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / doc / postgresql / html / maintenance.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Routine Database Maintenance Tasks</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
9 REV="MADE"
10 HREF="mailto:pgsql-docs@postgresql.org"><LINK
11 REL="HOME"
12 TITLE="PostgreSQL 7.4.1 Documentation"
13 HREF="index.html"><LINK
14 REL="UP"
15 TITLE="Server Administration"
16 HREF="admin.html"><LINK
17 REL="PREVIOUS"
18 TITLE="Character Set Support"
19 HREF="multibyte.html"><LINK
20 REL="NEXT"
21 TITLE="Routine Reindexing"
22 HREF="routine-reindex.html"><LINK
23 REL="STYLESHEET"
24 TYPE="text/css"
25 HREF="stylesheet.css"><META
26 NAME="creation"
27 CONTENT="2003-12-22T03:48:47"></HEAD
28 ><BODY
29 CLASS="CHAPTER"
30 ><DIV
31 CLASS="NAVHEADER"
32 ><TABLE
33 SUMMARY="Header navigation table"
34 WIDTH="100%"
35 BORDER="0"
36 CELLPADDING="0"
37 CELLSPACING="0"
38 ><TR
39 ><TH
40 COLSPAN="5"
41 ALIGN="center"
42 VALIGN="bottom"
43 >PostgreSQL 7.4.1 Documentation</TH
44 ></TR
45 ><TR
46 ><TD
47 WIDTH="10%"
48 ALIGN="left"
49 VALIGN="top"
50 ><A
51 HREF="multibyte.html"
52 ACCESSKEY="P"
53 >Prev</A
54 ></TD
55 ><TD
56 WIDTH="10%"
57 ALIGN="left"
58 VALIGN="top"
59 ><A
60 HREF="charset.html"
61 >Fast Backward</A
62 ></TD
63 ><TD
64 WIDTH="60%"
65 ALIGN="center"
66 VALIGN="bottom"
67 ></TD
68 ><TD
69 WIDTH="10%"
70 ALIGN="right"
71 VALIGN="top"
72 ><A
73 HREF="backup.html"
74 >Fast Forward</A
75 ></TD
76 ><TD
77 WIDTH="10%"
78 ALIGN="right"
79 VALIGN="top"
80 ><A
81 HREF="routine-reindex.html"
82 ACCESSKEY="N"
83 >Next</A
84 ></TD
85 ></TR
86 ></TABLE
87 ><HR
88 ALIGN="LEFT"
89 WIDTH="100%"></DIV
90 ><DIV
91 CLASS="CHAPTER"
92 ><H1
93 ><A
94 NAME="MAINTENANCE"
95 ></A
96 >Chapter 21. Routine Database Maintenance Tasks</H1
97 ><DIV
98 CLASS="TOC"
99 ><DL
100 ><DT
101 ><B
102 >Table of Contents</B
103 ></DT
104 ><DT
105 >21.1. <A
106 HREF="maintenance.html#ROUTINE-VACUUMING"
107 >Routine Vacuuming</A
108 ></DT
109 ><DD
110 ><DL
111 ><DT
112 >21.1.1. <A
113 HREF="maintenance.html#VACUUM-FOR-SPACE-RECOVERY"
114 >Recovering disk space</A
115 ></DT
116 ><DT
117 >21.1.2. <A
118 HREF="maintenance.html#VACUUM-FOR-STATISTICS"
119 >Updating planner statistics</A
120 ></DT
121 ><DT
122 >21.1.3. <A
123 HREF="maintenance.html#VACUUM-FOR-WRAPAROUND"
124 >Preventing transaction ID wraparound failures</A
125 ></DT
126 ></DL
127 ></DD
128 ><DT
129 >21.2. <A
130 HREF="routine-reindex.html"
131 >Routine Reindexing</A
132 ></DT
133 ><DT
134 >21.3. <A
135 HREF="logfile-maintenance.html"
136 >Log File Maintenance</A
137 ></DT
138 ></DL
139 ></DIV
140 ><A
141 NAME="AEN18689"
142 ></A
143 ><P
144 >   There are a few routine maintenance chores that must be performed on
145    a regular basis to keep a <SPAN
146 CLASS="PRODUCTNAME"
147 >PostgreSQL</SPAN
148 >
149    server running smoothly.  The tasks discussed here are repetitive
150    in nature and can easily be automated using standard Unix tools such
151    as <SPAN
152 CLASS="APPLICATION"
153 >cron</SPAN
154 > scripts.  But it is the database
155    administrator's responsibility to set up appropriate scripts, and to
156    check that they execute successfully.
157   </P
158 ><P
159 >   One obvious maintenance task is creation of backup copies of the data on a
160    regular schedule.  Without a recent backup, you have no chance of recovery
161    after a catastrophe (disk failure, fire, mistakenly dropping a critical
162    table, etc.).  The backup and recovery mechanisms available in
163    <SPAN
164 CLASS="PRODUCTNAME"
165 >PostgreSQL</SPAN
166 > are discussed at length in
167    <A
168 HREF="backup.html"
169 >Chapter 22</A
170 >.
171   </P
172 ><P
173 >   The other main category of maintenance task is periodic <SPAN
174 CLASS="QUOTE"
175 >"vacuuming"</SPAN
176 >
177    of the database.  This activity is discussed in
178    <A
179 HREF="maintenance.html#ROUTINE-VACUUMING"
180 >Section 21.1</A
181 >.
182   </P
183 ><P
184 >   Something else that might need periodic attention is log file management.
185    This is discussed in <A
186 HREF="logfile-maintenance.html"
187 >Section 21.3</A
188 >.
189   </P
190 ><P
191 >   <SPAN
192 CLASS="PRODUCTNAME"
193 >PostgreSQL</SPAN
194 > is low-maintenance compared
195    to some other database management systems.  Nonetheless,
196    appropriate attention to these tasks will go far towards ensuring a
197    pleasant and productive experience with the system.
198   </P
199 ><DIV
200 CLASS="SECT1"
201 ><H1
202 CLASS="SECT1"
203 ><A
204 NAME="ROUTINE-VACUUMING"
205 >21.1. Routine Vacuuming</A
206 ></H1
207 ><A
208 NAME="AEN18706"
209 ></A
210 ><P
211 >   <SPAN
212 CLASS="PRODUCTNAME"
213 >PostgreSQL</SPAN
214 >'s <TT
215 CLASS="COMMAND"
216 >VACUUM</TT
217 > command
218    must be run on a regular basis for several reasons:
219
220     <P
221 ></P
222 ></P><OL
223 TYPE="1"
224 ><LI
225 ><P
226 >To recover disk space occupied by updated or deleted
227       rows.</P
228 ></LI
229 ><LI
230 ><P
231 >To update data statistics used by the
232       <SPAN
233 CLASS="PRODUCTNAME"
234 >PostgreSQL</SPAN
235 > query planner.</P
236 ></LI
237 ><LI
238 ><P
239 >To protect against loss of very old data due to
240       <I
241 CLASS="FIRSTTERM"
242 >transaction ID wraparound</I
243 >.</P
244 ></LI
245 ></OL
246 ><P>
247
248    The frequency and scope of the <TT
249 CLASS="COMMAND"
250 >VACUUM</TT
251 > operations performed for each of
252    these reasons will vary depending on the needs of each site.
253    Therefore, database administrators must understand these issues and
254    develop an appropriate maintenance strategy.  This section concentrates
255    on explaining the high-level issues; for details about command syntax
256    and so on, see the <TT
257 CLASS="COMMAND"
258 >VACUUM</TT
259 > command reference page.
260   </P
261 ><P
262 >   Beginning in <SPAN
263 CLASS="PRODUCTNAME"
264 >PostgreSQL</SPAN
265 > 7.2, the standard form
266    of <TT
267 CLASS="COMMAND"
268 >VACUUM</TT
269 > can run in parallel with normal database operations
270    (selects, inserts, updates, deletes, but not changes to table definitions).
271    Routine vacuuming is therefore not nearly as intrusive as it was in prior
272    releases, and it's not as critical to try to schedule it at low-usage
273    times of day.
274   </P
275 ><DIV
276 CLASS="SECT2"
277 ><H2
278 CLASS="SECT2"
279 ><A
280 NAME="VACUUM-FOR-SPACE-RECOVERY"
281 >21.1.1. Recovering disk space</A
282 ></H2
283 ><A
284 NAME="AEN18727"
285 ></A
286 ><P
287 >    In normal <SPAN
288 CLASS="PRODUCTNAME"
289 >PostgreSQL</SPAN
290 > operation, an
291     <TT
292 CLASS="COMMAND"
293 >UPDATE</TT
294 > or <TT
295 CLASS="COMMAND"
296 >DELETE</TT
297 > of a row does not
298     immediately remove the old version of the row.
299     This approach is necessary to gain the benefits of multiversion
300     concurrency control (see <A
301 HREF="mvcc.html"
302 >Chapter 12</A
303 >): the row version
304     must not be deleted while it is still potentially visible to other
305     transactions. But eventually, an outdated or deleted row version is no
306     longer of interest to any transaction. The space it occupies must be
307     reclaimed for reuse by new rows, to avoid infinite growth of disk
308     space requirements. This is done by running <TT
309 CLASS="COMMAND"
310 >VACUUM</TT
311 >.
312    </P
313 ><P
314 >    Clearly, a table that receives frequent updates or deletes will need
315     to be vacuumed more often than tables that are seldom updated. It
316     may be useful to set up periodic <SPAN
317 CLASS="APPLICATION"
318 >cron</SPAN
319 > tasks that
320     vacuum only selected tables, skipping tables that are known not to
321     change often. This is only likely to be helpful if you have both
322     large heavily-updated tables and large seldom-updated tables --- the
323     extra cost of vacuuming a small table isn't enough to be worth
324     worrying about.
325    </P
326 ><P
327 >    The standard form of <TT
328 CLASS="COMMAND"
329 >VACUUM</TT
330 > is best used with the goal of
331     maintaining a fairly level steady-state usage of disk space.  The standard
332     form finds old row versions and makes their space available for re-use within
333     the table, but it does not try very hard to shorten the table file and
334     return disk space to the operating system.  If you need to return disk
335     space to the operating system you can use <TT
336 CLASS="COMMAND"
337 >VACUUM FULL</TT
338 > ---
339     but what's the point of releasing disk space that will only have to be
340     allocated again soon?  Moderately frequent standard <TT
341 CLASS="COMMAND"
342 >VACUUM</TT
343 > runs
344     are a better approach than infrequent <TT
345 CLASS="COMMAND"
346 >VACUUM FULL</TT
347 > runs for
348     maintaining heavily-updated tables.
349    </P
350 ><P
351 >    Recommended practice for most sites is to schedule a database-wide
352     <TT
353 CLASS="COMMAND"
354 >VACUUM</TT
355 > once a day at a low-usage time of day, supplemented
356     by more frequent vacuuming of heavily-updated tables if necessary.
357     (If you have multiple databases in a cluster, don't forget to
358     vacuum each one; the program <TT
359 CLASS="FILENAME"
360 >vacuumdb</TT
361 > may be helpful.)
362     Use plain <TT
363 CLASS="COMMAND"
364 >VACUUM</TT
365 >, not <TT
366 CLASS="COMMAND"
367 >VACUUM FULL</TT
368 >, for routine
369     vacuuming for space recovery.
370    </P
371 ><P
372 >    <TT
373 CLASS="COMMAND"
374 >VACUUM FULL</TT
375 > is recommended for cases where you know you have
376     deleted the majority of rows in a table, so that the steady-state size
377     of the table can be shrunk substantially with <TT
378 CLASS="COMMAND"
379 >VACUUM FULL</TT
380 >'s
381     more aggressive approach.
382    </P
383 ><P
384 >    If you have a table whose contents are deleted completely every so often,
385     consider doing it with <TT
386 CLASS="COMMAND"
387 >TRUNCATE</TT
388 > rather than using
389     <TT
390 CLASS="COMMAND"
391 >DELETE</TT
392 > followed by <TT
393 CLASS="COMMAND"
394 >VACUUM</TT
395 >.
396    </P
397 ></DIV
398 ><DIV
399 CLASS="SECT2"
400 ><H2
401 CLASS="SECT2"
402 ><A
403 NAME="VACUUM-FOR-STATISTICS"
404 >21.1.2. Updating planner statistics</A
405 ></H2
406 ><A
407 NAME="AEN18756"
408 ></A
409 ><A
410 NAME="AEN18759"
411 ></A
412 ><P
413 >    The <SPAN
414 CLASS="PRODUCTNAME"
415 >PostgreSQL</SPAN
416 > query planner relies on
417     statistical information about the contents of tables in order to
418     generate good plans for queries.  These statistics are gathered by
419     the <TT
420 CLASS="COMMAND"
421 >ANALYZE</TT
422 > command, which can be invoked by itself or
423     as an optional step in <TT
424 CLASS="COMMAND"
425 >VACUUM</TT
426 >.  It is important to have
427     reasonably accurate statistics, otherwise poor choices of plans may
428     degrade database performance.
429    </P
430 ><P
431 >    As with vacuuming for space recovery, frequent updates of statistics
432     are more useful for heavily-updated tables than for seldom-updated
433     ones. But even for a heavily-updated table, there may be no need for
434     statistics updates if the statistical distribution of the data is
435     not changing much. A simple rule of thumb is to think about how much
436     the minimum and maximum values of the columns in the table change.
437     For example, a <TT
438 CLASS="TYPE"
439 >timestamp</TT
440 > column that contains the time
441     of row update will have a constantly-increasing maximum value as
442     rows are added and updated; such a column will probably need more
443     frequent statistics updates than, say, a column containing URLs for
444     pages accessed on a website. The URL column may receive changes just
445     as often, but the statistical distribution of its values probably
446     changes relatively slowly.
447    </P
448 ><P
449 >    It is possible to run <TT
450 CLASS="COMMAND"
451 >ANALYZE</TT
452 > on specific tables and even
453     just specific columns of a table, so the flexibility exists to update some
454     statistics more frequently than others if your application requires it.
455     In practice, however, the usefulness of this feature is doubtful.
456     Beginning in <SPAN
457 CLASS="PRODUCTNAME"
458 >PostgreSQL</SPAN
459 > 7.2,
460     <TT
461 CLASS="COMMAND"
462 >ANALYZE</TT
463 > is a fairly fast operation even on large tables,
464     because it uses a statistical random sampling of the rows of a table
465     rather than reading every single row.  So it's probably much simpler
466     to just run it over the whole database every so often.
467    </P
468 ><DIV
469 CLASS="TIP"
470 ><BLOCKQUOTE
471 CLASS="TIP"
472 ><P
473 ><B
474 >Tip: </B
475 >     Although per-column tweaking of <TT
476 CLASS="COMMAND"
477 >ANALYZE</TT
478 > frequency may not be
479      very productive, you may well find it worthwhile to do per-column
480      adjustment of the level of detail of the statistics collected by
481      <TT
482 CLASS="COMMAND"
483 >ANALYZE</TT
484 >.  Columns that are heavily used in <TT
485 CLASS="LITERAL"
486 >WHERE</TT
487 > clauses
488      and have highly irregular data distributions may require a finer-grain
489      data histogram than other columns.  See <TT
490 CLASS="COMMAND"
491 >ALTER TABLE SET
492      STATISTICS</TT
493 >.
494     </P
495 ></BLOCKQUOTE
496 ></DIV
497 ><P
498 >    Recommended practice for most sites is to schedule a database-wide
499     <TT
500 CLASS="COMMAND"
501 >ANALYZE</TT
502 > once a day at a low-usage time of day; this can
503     usefully be combined with a nightly <TT
504 CLASS="COMMAND"
505 >VACUUM</TT
506 >.  However,
507     sites with relatively slowly changing table statistics may find that
508     this is overkill, and that less-frequent <TT
509 CLASS="COMMAND"
510 >ANALYZE</TT
511 > runs
512     are sufficient.
513    </P
514 ></DIV
515 ><DIV
516 CLASS="SECT2"
517 ><H2
518 CLASS="SECT2"
519 ><A
520 NAME="VACUUM-FOR-WRAPAROUND"
521 >21.1.3. Preventing transaction ID wraparound failures</A
522 ></H2
523 ><A
524 NAME="AEN18783"
525 ></A
526 ><P
527 >    <SPAN
528 CLASS="PRODUCTNAME"
529 >PostgreSQL</SPAN
530 >'s MVCC transaction semantics
531     depend on being able to compare transaction ID (<ACRONYM
532 CLASS="ACRONYM"
533 >XID</ACRONYM
534 >)
535     numbers: a row version with an insertion XID greater than the current
536     transaction's XID is <SPAN
537 CLASS="QUOTE"
538 >"in the future"</SPAN
539 > and should not be visible
540     to the current transaction.  But since transaction IDs have limited size
541     (32 bits at this writing) a cluster that runs for a long time (more
542     than 4 billion transactions) will suffer <I
543 CLASS="FIRSTTERM"
544 >transaction ID
545     wraparound</I
546 >: the XID counter wraps around to zero, and all of a sudden
547     transactions that were in the past appear to be in the future --- which
548     means their outputs become invisible.  In short, catastrophic data loss.
549     (Actually the data is still there, but that's cold comfort if you can't
550     get at it.)
551    </P
552 ><P
553 >    Prior to <SPAN
554 CLASS="PRODUCTNAME"
555 >PostgreSQL</SPAN
556 > 7.2, the only defense
557     against XID wraparound was to re-<TT
558 CLASS="COMMAND"
559 >initdb</TT
560 > at least every 4
561     billion transactions. This of course was not very satisfactory for
562     high-traffic sites, so a better solution has been devised. The new
563     approach allows a server to remain up indefinitely, without
564     <TT
565 CLASS="COMMAND"
566 >initdb</TT
567 > or any sort of restart. The price is this
568     maintenance requirement: <SPAN
569 CLASS="emphasis"
570 ><I
571 CLASS="EMPHASIS"
572 >every table in the database must
573     be vacuumed at least once every billion transactions</I
574 ></SPAN
575 >.
576    </P
577 ><P
578 >    In practice this isn't an onerous requirement, but since the
579     consequences of failing to meet it can be complete data loss (not
580     just wasted disk space or slow performance), some special provisions
581     have been made to help database administrators keep track of the
582     time since the last <TT
583 CLASS="COMMAND"
584 >VACUUM</TT
585 >. The remainder of this
586     section gives the details.
587    </P
588 ><P
589 >    The new approach to XID comparison distinguishes two special XIDs,
590     numbers 1 and 2 (<TT
591 CLASS="LITERAL"
592 >BootstrapXID</TT
593 > and
594     <TT
595 CLASS="LITERAL"
596 >FrozenXID</TT
597 >). These two XIDs are always considered older
598     than every normal XID. Normal XIDs (those greater than 2) are
599     compared using modulo-2<SUP
600 >31</SUP
601 > arithmetic. This means
602     that for every normal XID, there are two billion XIDs that are
603     <SPAN
604 CLASS="QUOTE"
605 >"older"</SPAN
606 > and two billion that are <SPAN
607 CLASS="QUOTE"
608 >"newer"</SPAN
609 >; another
610     way to say it is that the normal XID space is circular with no
611     endpoint. Therefore, once a row version has been created with a particular
612     normal XID, the row version will appear to be <SPAN
613 CLASS="QUOTE"
614 >"in the past"</SPAN
615 > for
616     the next two billion transactions, no matter which normal XID we are
617     talking about. If the row version still exists after more than two billion
618     transactions, it will suddenly appear to be in the future. To
619     prevent data loss, old row versions must be reassigned the XID
620     <TT
621 CLASS="LITERAL"
622 >FrozenXID</TT
623 > sometime before they reach the
624     two-billion-transactions-old mark. Once they are assigned this
625     special XID, they will appear to be <SPAN
626 CLASS="QUOTE"
627 >"in the past"</SPAN
628 > to all
629     normal transactions regardless of wraparound issues, and so such
630     row versions will be good until deleted, no matter how long that is. This
631     reassignment of XID is handled by <TT
632 CLASS="COMMAND"
633 >VACUUM</TT
634 >.
635    </P
636 ><P
637 >    <TT
638 CLASS="COMMAND"
639 >VACUUM</TT
640 >'s normal policy is to reassign <TT
641 CLASS="LITERAL"
642 >FrozenXID</TT
643 >
644     to any row version with a normal XID more than one billion transactions in the
645     past.  This policy preserves the original insertion XID until it is not
646     likely to be of interest anymore.  (In fact, most row versions will probably
647     live and die without ever being <SPAN
648 CLASS="QUOTE"
649 >"frozen"</SPAN
650 >.)  With this policy,
651     the maximum safe interval between <TT
652 CLASS="COMMAND"
653 >VACUUM</TT
654 > runs on any table
655     is exactly one billion transactions: if you wait longer, it's possible
656     that a row version that was not quite old enough to be reassigned last time
657     is now more than two billion transactions old and has wrapped around
658     into the future --- i.e., is lost to you.  (Of course, it'll reappear
659     after another two billion transactions, but that's no help.)
660    </P
661 ><P
662 >    Since periodic <TT
663 CLASS="COMMAND"
664 >VACUUM</TT
665 > runs are needed anyway for the reasons
666     described earlier, it's unlikely that any table would not be vacuumed
667     for as long as a billion transactions.  But to help administrators ensure
668     this constraint is met, <TT
669 CLASS="COMMAND"
670 >VACUUM</TT
671 > stores transaction ID
672     statistics in the system table <TT
673 CLASS="LITERAL"
674 >pg_database</TT
675 >.  In particular,
676     the <TT
677 CLASS="LITERAL"
678 >datfrozenxid</TT
679 > column of a database's
680     <TT
681 CLASS="LITERAL"
682 >pg_database</TT
683 > row is updated at the completion of any
684     database-wide vacuum operation (i.e., <TT
685 CLASS="COMMAND"
686 >VACUUM</TT
687 > that does not
688     name a specific table).  The value stored in this field is the freeze
689     cutoff XID that was used by that <TT
690 CLASS="COMMAND"
691 >VACUUM</TT
692 > command.  All normal
693     XIDs older than this cutoff XID are guaranteed to have been replaced by
694     <TT
695 CLASS="LITERAL"
696 >FrozenXID</TT
697 > within that database.  A convenient way to
698     examine this information is to execute the query
699
700 </P><PRE
701 CLASS="PROGRAMLISTING"
702 >SELECT datname, age(datfrozenxid) FROM pg_database;</PRE
703 ><P>
704
705     The <TT
706 CLASS="LITERAL"
707 >age</TT
708 > column measures the number of transactions from the
709     cutoff XID to the current transaction's XID.
710    </P
711 ><P
712 >    With the standard freezing policy, the <TT
713 CLASS="LITERAL"
714 >age</TT
715 > column will start
716     at one billion for a freshly-vacuumed database.  When the <TT
717 CLASS="LITERAL"
718 >age</TT
719 >
720     approaches two billion, the database must be vacuumed again to avoid
721     risk of wraparound failures.  Recommended practice is to vacuum each
722     database at least once every half-a-billion (500 million) transactions,
723     so as to provide plenty of safety margin.  To help meet this rule,
724     each database-wide <TT
725 CLASS="COMMAND"
726 >VACUUM</TT
727 > automatically delivers a warning
728     if there are any <TT
729 CLASS="LITERAL"
730 >pg_database</TT
731 > entries showing an
732     <TT
733 CLASS="LITERAL"
734 >age</TT
735 > of more than 1.5 billion transactions, for example:
736
737 </P><PRE
738 CLASS="PROGRAMLISTING"
739 >play=# VACUUM;
740 WARNING:  some databases have not been vacuumed in 1613770184 transactions
741 HINT:  Better vacuum them within 533713463 transactions, or you may have a wraparound failure.
742 VACUUM</PRE
743 ><P>
744    </P
745 ><P
746 >    <TT
747 CLASS="COMMAND"
748 >VACUUM</TT
749 > with the <TT
750 CLASS="COMMAND"
751 >FREEZE</TT
752 > option uses a more
753     aggressive freezing policy: row versions are frozen if they are old enough
754     to be considered good by all open transactions. In particular, if a
755     <TT
756 CLASS="COMMAND"
757 >VACUUM FREEZE</TT
758 > is performed in an otherwise-idle
759     database, it is guaranteed that <SPAN
760 CLASS="emphasis"
761 ><I
762 CLASS="EMPHASIS"
763 >all</I
764 ></SPAN
765 > row versions in that
766     database will be frozen. Hence, as long as the database is not
767     modified in any way, it will not need subsequent vacuuming to avoid
768     transaction ID wraparound problems. This technique is used by
769     <TT
770 CLASS="COMMAND"
771 >initdb</TT
772 > to prepare the <TT
773 CLASS="LITERAL"
774 >template0</TT
775 > database.
776     It should also be used to prepare any user-created databases that
777     are to be marked <TT
778 CLASS="LITERAL"
779 >datallowconn</TT
780 > = <TT
781 CLASS="LITERAL"
782 >false</TT
783 > in
784     <TT
785 CLASS="LITERAL"
786 >pg_database</TT
787 >, since there isn't any convenient way to
788     vacuum a database that you can't connect to. Note that
789     <TT
790 CLASS="COMMAND"
791 >VACUUM</TT
792 >'s automatic warning message about
793     unvacuumed databases will ignore <TT
794 CLASS="LITERAL"
795 >pg_database</TT
796 > entries
797     with <TT
798 CLASS="LITERAL"
799 >datallowconn</TT
800 > = <TT
801 CLASS="LITERAL"
802 >false</TT
803 >, so as to avoid
804     giving false warnings about these databases; therefore it's up to
805     you to ensure that such databases are frozen correctly.
806    </P
807 ></DIV
808 ></DIV
809 ></DIV
810 ><DIV
811 CLASS="NAVFOOTER"
812 ><HR
813 ALIGN="LEFT"
814 WIDTH="100%"><TABLE
815 SUMMARY="Footer navigation table"
816 WIDTH="100%"
817 BORDER="0"
818 CELLPADDING="0"
819 CELLSPACING="0"
820 ><TR
821 ><TD
822 WIDTH="33%"
823 ALIGN="left"
824 VALIGN="top"
825 ><A
826 HREF="multibyte.html"
827 ACCESSKEY="P"
828 >Prev</A
829 ></TD
830 ><TD
831 WIDTH="34%"
832 ALIGN="center"
833 VALIGN="top"
834 ><A
835 HREF="index.html"
836 ACCESSKEY="H"
837 >Home</A
838 ></TD
839 ><TD
840 WIDTH="33%"
841 ALIGN="right"
842 VALIGN="top"
843 ><A
844 HREF="routine-reindex.html"
845 ACCESSKEY="N"
846 >Next</A
847 ></TD
848 ></TR
849 ><TR
850 ><TD
851 WIDTH="33%"
852 ALIGN="left"
853 VALIGN="top"
854 >Character Set Support</TD
855 ><TD
856 WIDTH="34%"
857 ALIGN="center"
858 VALIGN="top"
859 ><A
860 HREF="admin.html"
861 ACCESSKEY="U"
862 >Up</A
863 ></TD
864 ><TD
865 WIDTH="33%"
866 ALIGN="right"
867 VALIGN="top"
868 >Routine Reindexing</TD
869 ></TR
870 ></TABLE
871 ></DIV
872 ></BODY
873 ></HTML
874 >