Skip to content

Instantly share code, notes, and snippets.

This is a really fast way to restore a large Postgres database by omiting the indexes and restoring them later (if necessary).

  1. Dump database.

    pg_dump -Fc --no-owner my_db -f ~/my_db.dump

  2. Create the summary files. One for the indexes and another for everything else.

pg_restore -l ~/my_db.dump | grep -v 'INDEX public' > ~/my_db.list

This is a really fast way to restore a large Postgres database by omiting the indexes and restoring them later (if necessary).

  1. Dump database.

     pg_dump -Fc --no-owner my_db -f ~/my_db.dump
    
  2. Create the summary files. One for the indexes and another for everything else.

pg_restore -l ~/my_db.dump | grep -v 'INDEX public' > ~/my_db.list