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

On Fri, May 30, 2025 at 6:09 AM hubert depesz lubaczewski <[email protected]>
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:

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



> And the assumption that: "it doesn't do what *I* want, so it's
> non-sense", is slightly exaggerating commonality of your experience.
>

The pgbackrest developer seems to think it's sensical to put timestamps in
each detail line.  They're right.

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


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]
  Subject: Re: pg_dump verbose start and stop times?
  In-Reply-To: <CANzqJaDVuTUxG+=gWiP0+qPqgEaKXJNxnEj9vyLi+2G3KWROUQ@mail.gmail.com>

* 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