On Fri, May 30, 2025 at 6:09 AM hubert depesz lubaczewski <depesz@depesz.com> wrote:
On Thu, May 29, 2025 at 08:51:49PM -0400, Ron Johnson wrote: > The non-sense of putting start and stop times in the dump file while not > putting them in stderr must have caused my brain to skip over "to the dump > file". > > Honestly, who cares if start and stop times are in the dump file? stderr > is where a DBA wants to see timings.
=$ date >&2; pg_dump …; date >&2
That's all you need.
That (poorly) tells me how long the whole dump took. Heck, it requires you to manually do the math yourself. Useful information like how long it took to dump each table (even more importantly: how long it took for pg_restore to copy each table, and create each index) is not shown.
Whether pg_dump does what you want, or not, is not really important given how easy it is to fix the thing yourself.
And yet it's not possible to show how long it takes to copy each object . This, at least, does the math to show the grand elapsed time, and puts an easily greppable string in the cron job's stdout+stderr log file: