Re: Fix for Extra Parenthesis in pgbench progress message - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Fix for Extra Parenthesis in pgbench progress message
Date
Msg-id 4k4drkh7bcmdezq6zbkhp25mnrzpswqi2o75d5uv2eeg3aq6q7@b7kqdmzzwzgb
Whole thread Raw
In response to Re: Fix for Extra Parenthesis in pgbench progress message  (Tatsuo Ishii <ishii@postgresql.org>)
Responses Re: Fix for Extra Parenthesis in pgbench progress message
Re: Fix for Extra Parenthesis in pgbench progress message
List pgsql-hackers
Hi,

On 2024-11-26 01:32:10 +0900, Fujii Masao wrote:
> On 2024/11/25 8:31, Tatsuo Ishii wrote:
> > Now that two minor releases are out, are you going to commit and
> > back-patch this?
>
> Yes, I will.
>
> But, the patch didn't apply cleanly to some back branches, so I've created
> and attached updated patches for them. Could you review these?
> If they look good, I'll proceed with pushing them.

I just did pgbench -i 100 -q via ssh and noticed it was *way* slower than I
expected.  Did it with debian's pgbench, no such issue.

It's due to this patch.

/srv/dev/build/m-opt/src/bin/pgbench/pgbench -i -s 10 -Idtg -h /tmp -q > /tmp/pgiu 2>&1

With HEAD:
pgbench -i -s 10 -Idtg -h /tmp -q 2>&1|wc
1000114      52 1000448

With af35fe501af reverted:
pgbench -i -s 10 -Idtg -h /tmp -q 2>&1|wc
      6      52     340

Outputting that many lines to the terminal causes noticeable slowdowns even
locally and make the terminal use a *lot* more cpu cycles.


With HEAD:

perf stat -p $(pidof gnome-terminal-server) /srv/dev/build/m-opt/src/bin/pgbench/pgbench -i -s 100 -Idtg -h /tmp -q
dropping old tables...
creating tables...
generating data (client-side)...
done in 6.31 s (drop tables 0.02 s, create tables 0.00 s, client-side generate 6.28 s).

 Performance counter stats for process id '3615':

          3,726.37 msec task-clock                       #    0.590 CPUs utilized
           692,360      context-switches                 #  185.800 K/sec
                49      cpu-migrations                   #   13.150 /sec
                 2      page-faults                      #    0.537 /sec
    13,340,182,520      instructions                     #    1.35  insn per cycle
                                                  #    0.14  stalled cycles per insn
     9,893,907,904      cycles                           #    2.655 GHz
     1,913,148,556      stalled-cycles-frontend          #   19.34% frontend cycles idle
     2,935,132,872      branches                         #  787.665 M/sec
        17,293,477      branch-misses                    #    0.59% of all branches

       6.315407944 seconds time elapsed



With af35fe501af reverted:

perf stat -p $(pidof gnome-terminal-server) /srv/dev/build/m-opt/src/bin/pgbench/pgbench -i -s 100 -Idtg -h /tmp -q
dropping old tables...
creating tables...
generating data (client-side)...
done in 5.77 s (drop tables 0.02 s, create tables 0.00 s, client-side generate 5.75 s).

 Performance counter stats for process id '3615':

            228.02 msec task-clock                       #    0.039 CPUs utilized
               239      context-switches                 #    1.048 K/sec
                16      cpu-migrations                   #   70.170 /sec
                 0      page-faults                      #    0.000 /sec
       298,383,249      instructions                     #    0.35  insn per cycle
                                                  #    0.28  stalled cycles per insn
       857,475,516      cycles                           #    3.761 GHz
        82,918,558      stalled-cycles-frontend          #    9.67% frontend cycles idle
        48,317,810      branches                         #  211.903 M/sec
           618,525      branch-misses                    #    1.28% of all branches

       5.780547274 seconds time elapsed


IOW, pgbench -i -s 100 -q got ~0.8s slower and made the terminal use 15x more
cycles.


Given the upcoming set of minor releases, I think it may be best for this this
patch ought to be reverted for now.


Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Draft back-branch release notes are up
Next
From: Nathan Bossart
Date:
Subject: Re: Trigger more frequent autovacuums of heavy insert tables