]> granicus.if.org Git - postgresql/commit
Make ANALYZE compute basic statistics even for types with no "=" operator.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 23 Sep 2015 22:26:49 +0000 (18:26 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 23 Sep 2015 22:26:49 +0000 (18:26 -0400)
commit82e1ba7fd6cc9ac3fb1d9b819dc7295b268d3703
tree8947f878ec1ad18be78813e894099436750b6a9d
parenta0d9f6e434bb56f7e5441b7988f3982feead33b3
Make ANALYZE compute basic statistics even for types with no "=" operator.

Previously, ANALYZE simply ignored columns of datatypes that have neither
a btree nor hash opclass (which means they have no recognized equality
operator).  Without a notion of equality, we can't identify most-common
values nor estimate the number of distinct values.  But we can still
count nulls and compute the average physical column width, and those
stats might be of value.  Moreover there are some tools out there that
don't work so well if rows are missing from pg_statistic.  So let's
add suitable logic for this case.

While this is arguably a bug fix, it also has the potential to change
query plans, and the gain seems not worth taking a risk of that in
stable branches.  So back-patch into 9.5 but not further.

Oleksandr Shulgin, rewritten a bit by me.
src/backend/commands/analyze.c