Re: Should we add timing output to pg_upgrade?

From: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Should we add timing output to pg_upgrade?
Date: 2026-12-02 09:41:01
Message-ID: CAKZiRmzyzPF-mkohO2_jDn0DBi9EwjL7iQFUCc-gotas=LzYpg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 1, 2026 at 10:08 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
[..]
> IMO, anyone running pg_upgrade on their production database has their
> database offline and probably wants as much detail as possible about
> what is currently happening and how long previous steps took, in the
> hope that's some sort of indication of how long future ones might take
> (which it's probably not).
>
> For me, I don't think hiding it behind some --debug or --verbose
> option is that useful. How often are people really looking at this
> output? I'd welcome actionable reports about pg_upgrade slowness, and
> I feel like we're more likely to receive actionable information with
> the timing on by default. We all work hard on new features for the
> next version of Postgres. If easing the pain of upgrading to that
> version encourages more people to use the latest version, then our
> work has more value.
>
> The format I used is very small for short and therefore uninteresting
> times. Longer times are more important and take up more space and
> therefore stand out more. That's all by design.

+1 and I think we miss such stuff all over the place, e.g. I've tried
to add "avg rate MB/s" like "base backup completed (avg %.1f MB/s)" in
pg_basebackup (see v06082026-0003 from [1]) without any feedback to that
to this day :(

Over and over again when looking at other people's problem one is unable to
tell why something took longer than expected so that patch would cover this.
Or people often ask why their pg_upgrade timing on testing env was
dramatically lower than on prod (but they learn it on prod only), so it would
be nice the output be self-answering somehow (it is with this patch).

I got ask one thing, though if we shouldn't add the same timings to the
dump/restore itself. Usually pg_dumpall/pg_dump/pg_restore phases take the
most time, and today we launch something like:

%/pg_dump --no-data --quote-all-identifiers --binary-upgrade \
--format=custom \
--no-sync --file=somewhere.sql
# notice no, "-v/--verbose" here it could be added

and

%s/pg_restore --exit-on-error --verbose --dbname db somewhere.sql
# -v is already there

E.g. if I run "pg_restore --verbose .. 2>&1 | awk '{print $1, $2, $3}' | \
sort | uniq -c" I can get:

1 pg_restore: connecting to
1 pg_restore: creating COMMENT
16231 pg_restore: creating CONSTRAINT
1 pg_restore: creating pg_largeobject
1 pg_restore: creating pg_largeobject_metadata
16231 pg_restore: creating TABLE
1 pg_restore: executing SELECT
1 pg_restore: processing data

so having some summary with generic count of object types like that and timing
(per object-type, not per each one of those) at the end would also be way more
useful too (even for non-upgrade scenarios too).

-J.

[1] - https://www.postgresql.org/message-id/CAKZiRmwwW-hDc3B6ERJB%2BpaX7RNSBcQLheq1KdsTf42cGuRvuA%40mail.gmail.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-12-02 09:42:20 Re: REPACK (CONCURRENTLY) fails during parallel build of exclusion constraint indexes
Previous Message shveta malik 2026-12-02 09:35:41 Re: DOC: Minor updates for logical replication conflicts