Commit 3154ea7
committed
store: Fix mistake in handling of histogram bounds in VidBatcher
When setting upa VidBatcher we have both accurate values for the range of
vids as well as Postgres' estimate of bounds for a histogram with roughly
the same number of entries in each bucket.
As an example, say we have min and max of 1 and 100, and histogram bounds
[5, 50, 96]. We used to then add min and max to these bounds resulting in
an ogive over [1, 5, 50, 96, 100]. With that, it seems that there is a
bucket [1, 5] with just as many entries as the bucket [5, 50], which is not
what the Posgres staistics indicate. Using this ogive will cause
e.g. pruning to increase batch size quickly as it tries to get out of the
[1, 5] bucket resulting in a batch size that is way too big for the next
bucket and a batch that can take a very long time.
The first and last entry of the bounds are Postgres' estimate of the min
and max. We now simply replace the first and last bound with our known min
and max, resulting in an ogive over [1, 50, 100], which reflects the
statistics much more accurately and avoids impossibly short buckets.1 parent 900f10a commit 3154ea7
1 file changed
+46
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
145 | 155 | | |
146 | 156 | | |
147 | 157 | | |
| |||
363 | 373 | | |
364 | 374 | | |
365 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
366 | 387 | | |
367 | 388 | | |
368 | 389 | | |
| |||
414 | 435 | | |
415 | 436 | | |
416 | 437 | | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
417 | 457 | | |
0 commit comments