On 08/23/2016 05:47 PM, Fabien COELHO wrote:
> 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;
Yep, it's clearly broken. Committed and backpatched down to 9.4. Thanks!
- Heikki