pgbench - fix stats when using \sleep - Mailing list pgsql-hackers

From Fabien COELHO
Subject pgbench - fix stats when using \sleep
Date
Msg-id alpine.DEB.2.20.1608231622170.7102@lancre
Whole thread Raw
Responses Re: pgbench - fix stats when using \sleep  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
Hello devs,

When \sleep is used within a pgbench script it resets txn_scheduled which
is used for computing stats about the transaction, resulting in absurd
statistics:

  latency average = 0.649 ms *** ??? ***
  ...
  script statistics:
   - statement latencies in milliseconds:
           0.235  BEGIN;
         100.301  \sleep 100 ms
           0.351  END;

I probably created this bug when adding "--rate" in 9.4 and trying to be
too clever. As nobody complained yet about it, I'm not sure it is worth
fixing it there, though.

The fix is that "\sleep" does not have to interfere with the txn_scheduled
field, see the attached patch.

  latency average = 100.237 ms  *** BETTER ***
  ...
  script statistics:
   - statement latencies in milliseconds:
           0.099  BEGIN;
         100.001  \sleep 100 ms
           0.135  END;

--
Fabien.
Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Block level parallel vacuum WIP
Next
From: Victor Wagner
Date:
Subject: Re: UTF-8 docs?