| From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> | 
|---|---|
| To: | PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | pgbench - fix stats when using \sleep | 
| Date: | 2016-08-23 14:47:19 | 
| Message-ID: | alpine.DEB.2.20.1608231622170.7102@lancre | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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 | Content-Type | Size | 
|---|---|---|
| pgbench-lat-sleep-1.patch | text/x-diff | 1.4 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Victor Wagner | 2016-08-23 14:47:54 | Re: UTF-8 docs? | 
| Previous Message | Masahiko Sawada | 2016-08-23 14:43:20 | Re: Block level parallel vacuum WIP |