forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2d76d75
committed
Fix compute_scalar_stats() for case that all values exceed WIDTH_THRESHOLD.
The standard typanalyze functions skip over values whose detoasted sizeexceeds WIDTH_THRESHOLD (1024 bytes), so as to limit memory bloat duringANALYZE. However, we (I think I, actually :-() failed to consider thepossibility that *every* non-null value in a column is too wide. Whilecompute_minimal_stats() seems to behave reasonably anyway in such a case,compute_scalar_stats() just fell through and generated no pg_statisticentry at all. That's unnecessarily pessimistic: we can still producevalid stanullfrac and stawidth values in such cases, since we do includetoo-wide values in the average-width calculation. Furthermore, since thegeneral assumption in this code is that too-wide values are probably alldistinct from each other, it seems reasonable to set stadistinct to -1("all distinct").Per complaint from Kadri Raudsepp. This has been like this since roughlyneolithic times, so back-patch to all supported branches.1 parenta29b6c3 commit2d76d75
1 file changed
+15
-1
lines changedLines changed: 15 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2651 | 2651 |
| |
2652 | 2652 |
| |
2653 | 2653 |
| |
2654 |
| - | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
| 2659 | + | |
| 2660 | + | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
2655 | 2669 |
| |
2656 | 2670 |
| |
2657 | 2671 |
| |
|
0 commit comments
Comments
(0)