aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-01-11 13:41:41 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-01-11 13:42:00 -0500
commit9387f4e1bdc25d2c49a820365c298280f2e8a066 (patch)
tree202bf9262aa831367e3a51a74a2a6ae5009e8959 /src/backend/tcop/postgres.c
parent9f5b3a1a1eb7f4b3b768654867777e0877bfda04 (diff)
downloadpostgresql-9387f4e1bdc25d2c49a820365c298280f2e8a066.tar.gz
postgresql-9387f4e1bdc25d2c49a820365c298280f2e8a066.zip
Fix compute_scalar_stats() for case that all values exceed WIDTH_THRESHOLD.
The standard typanalyze functions skip over values whose detoasted size exceeds WIDTH_THRESHOLD (1024 bytes), so as to limit memory bloat during ANALYZE. However, we (I think I, actually :-() failed to consider the possibility that *every* non-null value in a column is too wide. While compute_minimal_stats() seems to behave reasonably anyway in such a case, compute_scalar_stats() just fell through and generated no pg_statistic entry at all. That's unnecessarily pessimistic: we can still produce valid stanullfrac and stawidth values in such cases, since we do include too-wide values in the average-width calculation. Furthermore, since the general assumption in this code is that too-wide values are probably all distinct from each other, it seems reasonable to set stadistinct to -1 ("all distinct"). Per complaint from Kadri Raudsepp. This has been like this since roughly neolithic times, so back-patch to all supported branches.
Diffstat (limited to 'src/backend/tcop/postgres.c')
0 files changed, 0 insertions, 0 deletions