Last Updated: February 25, 2016
·
2.228K
· datasaur

Pipe Viewer views pipes - and long running restores

Example:

pv dump.sql.gz | zcat | psql db_name

Displays progress in the form of:

359MB 0:35:14 [28.4MB/s] [==>       ]  12% ETA 2:28:41

Monitoring a PostgreSQL dump, including time estimate based on total table data size:

pg_dump  $db| pv -s $(psql -d $db -tc "SELECT SUM(pg_table_size(oid)) FROM pg_class WHERE relkind='r'") | pigz -c > /backup/$db.sql.gz

http://www.ivarch.com/programs/pv.shtml

Edit 2012-01-01: Updated backup example to base time estimate on table data only, not index size