forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc8b2499
committed
Simplify calculation of Poisson distributed delays in pgbench --rate mode.
The previous coding first generated a uniform random value between 0.0 and1.0, then converted that to an integer between 1 and 10000, and divided thatagain by 10000. Those conversions are unnecessary; we can use the doublevalue that pg_erand48() returns directly. While we're at it, put the logicinto a helper function, getPoissonRand().The largest delay generated by the old coding was about 9.2 times theaverage, because of the way the uniformly distributed value used for thecalculation was truncated to 1/10000 granularity. The new coding doesn'thave such clamping. With my laptop's DBL_MIN value, the maximum delay withthe new coding is about 700x the average. That seems acceptable - anyreasonable pgbench session should last long enough to average that out.Backpatch to 9.4.1 parent8c9dd69 commitc8b2499
1 file changed
+22
-11
lines changedLines changed: 22 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
476 | 476 |
| |
477 | 477 |
| |
478 | 478 |
| |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
479 | 498 |
| |
480 | 499 |
| |
481 | 500 |
| |
| |||
933 | 952 |
| |
934 | 953 |
| |
935 | 954 |
| |
936 |
| - | |
937 |
| - | |
938 |
| - | |
939 |
| - | |
940 |
| - | |
941 |
| - | |
942 |
| - | |
943 |
| - | |
944 |
| - | |
| 955 | + | |
| 956 | + | |
945 | 957 |
| |
946 | 958 |
| |
947 | 959 |
| |
948 | 960 |
| |
949 |
| - | |
950 |
| - | |
| 961 | + | |
951 | 962 |
| |
952 | 963 |
| |
953 | 964 |
| |
|
0 commit comments
Comments
(0)