- endterm="sql-analyze-title"> on each database so the optimizer has
- useful statistics. An easy way to do this is to run
- vacuumdb -a -z> to
- VACUUM ANALYZE> all databases; this is equivalent to
- running VACUUM ANALYZE manually.
+ By default, the
psql> script will continue to
+ execute after an SQL error is encountered. You may wish to use the
+ following command at the top of the script to alter that
+ behaviour and have
psql exit with an
+ exit status of 3 if an SQL error occurs:
+\set ON_ERROR_STOP
+
+ Either way, you will only have a partially restored
+ dump. Alternatively, you can specify that the whole dump should be
+ restored as a single transaction, so the restore is either fully
+ completed or fully rolled back. This mode can be specified by
+ passing the -1> or --single-transaction>
+ command-line options to
psql>. When using this
+ mode, be aware that even the smallest of errors can rollback a
+ restore that has already run for many hours. However, that may
+ still be preferable to manually cleaning up a complex database
+ after a partially restored dump.
- For advice on how to load large amounts of data into
-
PostgreSQL efficiently, refer to
+ After restoring a backup, it is wise to run
+ linkend="sql-analyze" endterm="sql-analyze-title"> on each
+ database so the query optimizer has useful statistics. An easy way
+ to do this is to run vacuumdb -a -z>; this is
+ equivalent to running VACUUM ANALYZE> on each database
+ manually. For more advice on how to load large amounts of data
+ into
PostgreSQL> efficiently, refer to
linkend="populate">.