Gaussian Pgbench v6 patch by Mitsumasa KONDO review & patch v7.
* The purpose of the patch is to allow a pgbench script to draw from normally distributed or exponentially distributed
integervalues instead of uniformly distributed.
This is a valuable contribution to enable pgbench to generate more realistic loads, which is seldom uniform in
practice.
* Changes
I have updated the patch (v7) based on Mitsumasa latest v6: - some code simplifications & formula changes. - I've
addedexplicit looping probability computations in comments to show the (low) looping probability of the iterative
search. - I've tried to clarify the sgml documentation. - I've removed the 5.0 default value as it was not used
anymore. - I've renamed some variables to match the naming style around.
* Compilation
The patch applies and compiles against current head. It works as expected, although there is few feedback from the
scriptto show that. By looking at the "aid" distribution in the "pgbench_history" table after a run, I could check
thatthe aid values are indeed skewed, depending on the parameters.
* Mathematical soundness
I've checked again the mathematical soundness for the methods involved.
After further thoughts, I'm not that sure that there is not a bias induced by taking the second value based on "cos"
whenthe first based on "sin" as failed the test. So I removed the cos computation for the gaussian version, and
simplifiedthe code accordingly. This mean that it may be a little less efficient, but I'm more confident that there is
nobias.
* Conclusion
If Mitsumasa-san is okay with the changes I have made, I would suggest to accept this patch.
--
Fabien.