Add some notes about how pg_dump relates to the practices recommended
authorTom Lane
Fri, 2 Sep 2005 03:19:53 +0000 (03:19 +0000)
committerTom Lane
Fri, 2 Sep 2005 03:19:53 +0000 (03:19 +0000)
under 'Populating a Database'.

doc/src/sgml/perform.sgml

index 458272a2e8fd2512f9e084744ff5d60ae407823c..a965c9641b07de30afa8781153400c727741230b 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -878,6 +878,54 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
     statistics.
    
   
+
+  
+   Some Notes About <application>pg_dump</>
+
+   
+    Dump scripts generated by pg_dump automatically apply
+    several, but not all, of the above guidelines.  To reload a
+    pg_dump dump as quickly as possible, you need to
+    do a few extra things manually.  (Note that these points apply while
+    restoring a dump, not while creating it.
+    The same points apply when using pg_restore to load
+    from a pg_dump archive file.)
+   
+
+   
+    By default, pg_dump uses COPY, and when
+    it is generating a complete schema-and-data dump, it is careful to
+    load data before creating indexes and foreign keys.  So in this case
+    the first several guidelines are handled automatically.  What is left
+    for you to do is to set appropriate (i.e., larger than normal) values
+    for maintenance_work_mem and
+    checkpoint_segments before loading the dump script,
+    and then to run ANALYZE afterwards.
+   
+
+   
+    A data-only dump will still use COPY, but it does not
+    drop or recreate indexes, and it does not normally touch foreign
+    keys.
+
+     
+      
+       You can get the effect of disabling foreign keys by using
+       the 
+       that eliminates, rather than just postponing, foreign key
+       validation, and so it is possible to insert bad data if you use it.
+      
+     
+
+    So when loading a data-only dump, it is up to you to drop and recreate
+    indexes and foreign keys if you wish to use those techniques.
+    It's still useful to increase checkpoint_segments
+    while loading the data, but don't bother increasing
+    maintenance_work_mem; rather, you'd do that while
+    manually recreating indexes and foreign keys afterwards.
+    And don't forget to ANALYZE when you're done.
+   
+