There are many reasons why you may want to exclude table data from specific tables during a pg_dump
. Tables might contain sensitive data (umm encryption!!), table size, unnecessary for things like local development, etc.
If you want to export a database include all table schemas and some, but not all, table data, use the --exclude-table-data
flag when executing pg_dump
.
pg_dump -c -s -U <Database User> -h <Database Host> -p <Database Port>
-d <Database Name> -f <Database Dump File>
--exclude-table-data 'public.*audit`
--exclude-table-data 'schema.some_*_pattern`
--exclude-table-data
will accept specific schemas and tables or will allow for wildcards (*) for more flexibility.