public inbox for [email protected]  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <[email protected]>
To: Ron Johnson <[email protected]>
Cc: Pgsql-admin <[email protected]>
Subject: Re: pg_dump verbose start and stop times?
Date: Fri, 30 May 2025 15:48:08 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CANzqJaDVuTUxG+=gWiP0+qPqgEaKXJNxnEj9vyLi+2G3KWROUQ@mail.gmail.com>
References: <CANzqJaDPKWHUTnJMbwY2qqDk8YPSP=-b7dJbBGKbBLYnqkFjiQ@mail.gmail.com>
	<CAKFQuwb_V35L1VYAevfon9ZbHPUxFcwhY1Ei07MNSm_5_Z-QjA@mail.gmail.com>
	<CANzqJaBbTaQyNvAmuBU9oZTcKMUk+2JyNFpPnDELzKVFiQ5PfQ@mail.gmail.com>
	<[email protected]>
	<CANzqJaDVuTUxG+=gWiP0+qPqgEaKXJNxnEj9vyLi+2G3KWROUQ@mail.gmail.com>

On Fri, May 30, 2025 at 08:54:24AM -0400, Ron Johnson wrote:
> 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:
> 
> time_it()
> {
>     local ActionLabel=$1
>     shift
>     date +"%n%F %T TIMEIT $ActionLabel started.%n"
>     START_SECS=$(date +"%s")
>     $@
>     local RC=$? ; echo "TIMEIT Return Code = $RC"
>     FINISH_SECS=$(date +"%s")
>     ET=$(echo "scale=2;(${FINISH_SECS} - ${START_SECS})/60" | bc)
>     date +"%n%F %T TIMEIT $ActionLabel finished. Elapsed time: ${ET}
> minutes."
>     return $RC
> }
> 
> time_it DUMP_$DB pg_dump -j ${Threads} -Z${ZLvl} -v -C -Fd --file=$DB $DB
> 2> ${DB}_pgdump.log

You do know that you could have just done:

time pg_dump …

without the time_it function?

And if you'd want to write your own function, assuming you're running
not-so-ancient bash, you could have just used $EPOCHREALTIME and not the
date +… ?

Best regards,

depesz






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: pg_dump verbose start and stop times?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox