diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-09-02 03:19:53 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-09-02 03:19:53 +0000 |
commit | 6c0398a73f0a8173996fb0bd638ca6ab7c82e5b6 (patch) | |
tree | 2a26c38f283c3445f2351b699806ef8354cad510 /doc/src | |
parent | 9a412be5ebf305a73b2c31c69f8cbccf1d20d974 (diff) | |
download | postgresql-6c0398a73f0a8173996fb0bd638ca6ab7c82e5b6.tar.gz postgresql-6c0398a73f0a8173996fb0bd638ca6ab7c82e5b6.zip |
Add some notes about how pg_dump relates to the practices recommended
under 'Populating a Database'.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/perform.sgml | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml index 458272a2e8f..a965c9641b0 100644 --- a/doc/src/sgml/perform.sgml +++ b/doc/src/sgml/perform.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.52 2005/09/02 00:57:57 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.53 2005/09/02 03:19:53 tgl Exp $ --> <chapter id="performance-tips"> @@ -878,6 +878,54 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse; statistics. </para> </sect2> + + <sect2 id="populate-pg-dump"> + <title>Some Notes About <application>pg_dump</></title> + + <para> + Dump scripts generated by <application>pg_dump</> automatically apply + several, but not all, of the above guidelines. To reload a + <application>pg_dump</> dump as quickly as possible, you need to + do a few extra things manually. (Note that these points apply while + <emphasis>restoring</> a dump, not while <emphasis>creating</> it. + The same points apply when using <application>pg_restore</> to load + from a <application>pg_dump</> archive file.) + </para> + + <para> + By default, <application>pg_dump</> uses <command>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 <varname>maintenance_work_mem</varname> and + <varname>checkpoint_segments</varname> before loading the dump script, + and then to run <command>ANALYZE</> afterwards. + </para> + + <para> + A data-only dump will still use <command>COPY</>, but it does not + drop or recreate indexes, and it does not normally touch foreign + keys. + + <footnote> + <para> + You can get the effect of disabling foreign keys by using + the <option>-X disable-triggers</> option — but realize that + that eliminates, rather than just postponing, foreign key + validation, and so it is possible to insert bad data if you use it. + </para> + </footnote> + + 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 <varname>checkpoint_segments</varname> + while loading the data, but don't bother increasing + <varname>maintenance_work_mem</varname>; rather, you'd do that while + manually recreating indexes and foreign keys afterwards. + And don't forget to <command>ANALYZE</> when you're done. + </para> + </sect2> </sect1> </chapter> |