postgresqlpg-restore

Exclude Table during pg_restore


UPDATE: Was able to exclude the data in the table durning the pg_dump command. Makes it even faster than trying to not load the data because you don't have to wait for that data to be dumped.

--exclude-table-data=event_logs

(PostgreSQL) 9.4.4

Anyone know how to exclude a table when doing a pg_restore? I can find how to do it when doing a pg_dump. However I am not the one doing the dump and can't exclude them.

There are 2 tables in the dump that are really big and take forever when I do a restore so I want to skip them.


Solution

  • pg_restore does not have an exclude table parameter, what it does have is an include table parameter.

    -t table

    --table=table

    Restore definition and/or data of named table only. Multiple tables may be specified with multiple -t switches. This can be combined with the -n option to specify a schema.

    If you have a large number of tables it does call for a litte bit of typing, but it does allow you to exclude specific tables by just leaving their names out of the list.