I am using postgres 12 and have a database thats 1TB in size. I am performing a big delete on a table that is 140+GB in size.
I am testing the process and am looking to do a pg_dump of the table and its contents however running as is takes approximately 33mins
pg_dump -d titan -t public.play > /backup/playBackup.sql
I know that pg_dump does include a --jobs option which given I have a 32 core machine could really utilise but that's to backup the database itself as opposed to a table in the database.
Is there a quicker way of backing up the table I need?
The
--jobs
option, which works only with a "database" format dump, won't help you with a single table, because a single table is dumped by a single process.You could of course start a couple of parallel
COPY
statements:If you start these statements at the same time, you have a chance to get synchronized sequential scans and get done with a single read of the table. Then you can load those files in parallel.
If you need the table structure too, run these:
First restore pre-data, then the data, then post-data.