snippetsqlModerate
how to track progress of a large postgres dump
Viewed 0 times
dumptrackpostgresprogresslargehow
Problem
Is there a way to see the progress of a
pg_dump operation on a big db (ie > 1GB)? adding the -v option just dumps text on the screen, but doesn't give me much meaningful tracking information.Solution
You can see a rough progress using the TOC list.
First, get the TOC list of objects to be restored:
Then, you can see the TOC list line by line and compare the output of verbose or query pg_stat_activity to see where in the TOC list is pg_restore in.
It is just a rough estimate though. First because each item from the TOC list may take really different time to load (for instance, schemas are fast, but loading data of big tables and building indexes are not), and if you use -j you'll have an item being restored before a previous one has finished. Also, I'm not 100% sure if pg_restore follows TOC list precisely if you don't use -L, but I think it does.
First, get the TOC list of objects to be restored:
pg_restore -l -f list.toc db.dumpThen, you can see the TOC list line by line and compare the output of verbose or query pg_stat_activity to see where in the TOC list is pg_restore in.
It is just a rough estimate though. First because each item from the TOC list may take really different time to load (for instance, schemas are fast, but loading data of big tables and building indexes are not), and if you use -j you'll have an item being restored before a previous one has finished. Also, I'm not 100% sure if pg_restore follows TOC list precisely if you don't use -L, but I think it does.
Code Snippets
pg_restore -l -f list.toc db.dumpContext
StackExchange Database Administrators Q#147750, answer score: 15
Revisions (0)
No revisions yet.