Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uKzFy-00FuXh-5Y for pgsql-admin@arkaria.postgresql.org; Fri, 30 May 2025 12:54:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uKzFw-001XD9-O8 for pgsql-admin@arkaria.postgresql.org; Fri, 30 May 2025 12:54:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uKzFw-001XD0-B4 for pgsql-admin@lists.postgresql.org; Fri, 30 May 2025 12:54:40 +0000 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uKzFt-000t7p-1o for pgsql-admin@lists.postgresql.org; Fri, 30 May 2025 12:54:40 +0000 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-2e8f7ca7ca3so1139817fac.2 for ; Fri, 30 May 2025 05:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748609676; x=1749214476; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=hQQyBrNKZ4iJfEZEEpVciIw8R4vEzIT3CEgisDD+R+o=; b=mv12pxsCuHijjCG9fkvNTyiA0/nlMDu8RW1gAebZm0BIuioCGkCD8QTr7ycD/egGBp lhSDuN8dFuHv5x+q5I/NPbMbNB3wM30zSYbj5wtsfcH54Lc+S3KH3rJETaj913sA8LmO 3qZGCDSlH+cXpRkVC7SRs2CDOagvB9I+edtzvJwAMzSNfpI3ZirT+pns26glcBX86Ihs uljjL5Dx+CSHE3IWgCNOdf5Kv1vSNs4zSoMNYRId8iktQTt3jv4QBk9IuwvkJTnkrfa9 kx6sGOeCNL4yaiUpGNixNJHnK0OIOyifgROtsrSxA1VqZj5U4snAh6fWMskdqDDGYjBj Az5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748609676; x=1749214476; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hQQyBrNKZ4iJfEZEEpVciIw8R4vEzIT3CEgisDD+R+o=; b=LpnzbcN/ST3fkKXgM1uexcIDEB/zKAAiU6UywbF3nCukEOymEi1z2vak0Y8c2Py0Me Xb5fGj6/yx4B4RAehI7nc7Gm81i7choTSFYzUR4nk5vVL+rt4ZlwT6OAKjB0IKE6ThP4 HJ5j1mzZ9LUHaS0QYaBFwNzCuO4uu2uv+EO8yw4grM0KcDBruycUPIR64B0bxhK4bTqb P79MtZzwK8HY1wgoNgH8v0hXHQXM8riarI3yEduwss/THHcmNVSRDLtlNJmVzCMXeDdq gY3CFL9ad7Hnp86gpdrWfl5n9oWu1P/TBMiR1yGcKXgyw2J2yRoCfMNnOQh3kITclVNp zH+w== X-Gm-Message-State: AOJu0YxvxZu9VOd+Sgy4j0Gjb5dn/8h6k1OWlDj1NSm6oW6/U3J9g/LG JPUXAAZJQCbtj4VGjlcflNvtmwECDPyDceoSkeg8VYSPLW3s1Zr3l0pfuDlBbuOx16aiVBEiEDr MmUdKtZNWE3z1k02kuZLNFm9Ons0PXc0RDjqZ X-Gm-Gg: ASbGnctPLvzpVbqpH5DWQw+XYynPFxORTDD4Vj0PUNQOJwSvuX1LK/kq2tzgYUtD/t6 8Pe02YtX6NHFrlYI1lD5mq0eRW+AVsimepByWRcH97PRJrPVt3VeaBaUjwiyOt+Kw7Pnkrojd3w 2UenYvFaB0JYrcy5zAafYzKspEYZ1zeDmNdQ== X-Google-Smtp-Source: AGHT+IGK4dTKBefsDJ3/Cmp+XhUBRaaBBy6rYZEFw0wF0q1gTTW5X+8TrOPMgBXvykO5H3bnrpkyGlwImNmBjUe7j9Q= X-Received: by 2002:a05:6871:452a:b0:2e9:11d9:f8ad with SMTP id 586e51a60fabf-2e921539291mr1435992fac.24.1748609675815; Fri, 30 May 2025 05:54:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Fri, 30 May 2025 08:54:24 -0400 X-Gm-Features: AX0GCFuaIUFXySWGBBE-s96pCWiFStcjMLbYXHDYQbW-IzM6PONziFwiLGTOdXs Message-ID: Subject: Re: pg_dump verbose start and stop times? To: Pgsql-admin Content-Type: multipart/alternative; boundary="00000000000093f4fc063659eac8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000093f4fc063659eac8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 30, 2025 at 6:09=E2=80=AFAM hubert depesz lubaczewski 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 no= t > > 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? stde= rr > > is where a DBA wants to see timings. > > =3D$ date >&2; pg_dump =E2=80=A6; 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=3D$1 shift date +"%n%F %T TIMEIT $ActionLabel started.%n" START_SECS=3D$(date +"%s") $@ local RC=3D$? ; echo "TIMEIT Return Code =3D $RC" FINISH_SECS=3D$(date +"%s") ET=3D$(echo "scale=3D2;(${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=3D$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. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --00000000000093f4fc063659eac8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, May 30, 2025 at 6:09=E2=80=AFAM h= ubert depesz lubaczewski <depesz@de= pesz.com> wrote:
On Thu, May 29, 2025 a= t 08:51:49PM -0400, Ron Johnson wrote:
> The non-sense of putting start and stop times in the dump file while n= ot
> 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?=C2= =A0 stderr
> is where a DBA wants to see timings.

=3D$ date >&2; pg_dump =E2=80=A6; date >&2

That's all you need.

That (poorly) = tells me how long the whole dump took.=C2=A0 Heck, it requires you to manua= lly do the math yourself.=C2=A0 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.
=C2=A0
Whether pg_dump does wh= at 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 ea= ch=C2=A0object .=C2=A0 This, at least, does the math to show the grand elap= sed=C2=A0time, and puts an easily greppable string in the cron job's=C2= =A0stdout+stderr log file:

time_it()
{
=C2=A0 =C2=A0 local ActionLabel=3D$1
=C2=A0 =C2=A0 s= hift
=C2=A0 =C2=A0 date +"%n%F %T TIMEIT $ActionLabel started.%n&qu= ot;
=C2=A0 =C2=A0 START_SECS=3D$(date +"%s")
=C2=A0 =C2=A0 = $@
=C2=A0 =C2=A0 local RC=3D$? ; echo "TIMEIT Return Code =3D $RC&q= uot;
=C2=A0 =C2=A0 FINISH_SECS=3D$(date +"%s")
=C2=A0 =C2= =A0 ET=3D$(echo "scale=3D2;(${FINISH_SECS} - ${START_SECS})/60" |= bc)
=C2=A0 =C2=A0 date +"%n%F %T TIMEIT $ActionLabel finished. Ela= psed time: ${ET} minutes."
=C2=A0 =C2=A0 return $RC
}

time_it DUMP_$DB pg_dump -j ${Threads} -Z${ZLvl} -v -C -Fd --file=3D$DB= $DB 2> ${DB}_pgdump.log

=C2=A0
And the assumption that: &qu= ot;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.=C2=A0 They're = right.

-- =
Deat= h to <Redacted>, and butter sauce.
Don't boil me, I'm sti= ll alive.
<Redacted> lobster!
--00000000000093f4fc063659eac8--