If I use pg_restore to restore the complete database I get all indexes for the tables. But when I try to import a single table there are never any indexes.

to backup i run

pg_dump -Fc -w database > my_database.dump

to restore a single table i run

pg_restore -t table_name -s my_database.dump

Which only returns the create table statement and missing the indexs, where am I going wrong?

1 Answer 1


If you use -t, you limit the operation to the table you named. Indices are different objects and need to be selected with the -I (or --index=) selector.

  • How about primary keys and serial columns. These seem to get lost too. Sep 30, 2016 at 10:23
  • any solution for this? I'm in a similar situacion where pg_dump backups all my DB but I'm unable to restore it with pg_restore, no indexes nor primary keys are restored.
    – acanimal
    Aug 30 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.