by random42 · 15y ago · 0 comments
Granted, this only exists for pg_restore (8.4 onwards), no equivalent functionality in postgres for pg_dump.
What I do is dump the schema, then split it between the table creation and the indexes. The first part gets loaded before the data, the second, after. Then all the tables and all the sequences are dumped, optionally teed to disk, and loaded in a psql process to the new location.
I've been doing this since the 7.x series, so it way predates 8.4. (It also predates the in place upgrades, which is a big thing that they've added since I was coming up to speed)