<div dir="ltr">On Mon, Aug 29, 2016 at 1:26 PM, Vik Fearing <<a
href="mailto:vik@2ndquadrant.fr">vik@2ndquadrant.fr</a>>wrote:<br />> While doing this, I noticed that ALTER
TABLEshould also re-analyze the<br />> table for obvious reasons, so I have that one set<br />>
"changes_since_analyze"to the number of rows rewritten as well.<br /><br />I noticed that ATExecAlterColumnType does
this:<br/><br /> /* <br /> * Drop any
pg_statisticentry for the column, since it's now wrong type <br /> */
<br /> RemoveStatistics(RelationGetRelid(rel), attnum); <br /><br />What if there is no
rewrite,because the type is binary compatible (ATColumnChangeRequiresRewrite returns false)? Then I think your patch
won'tattract an autovacuum daemon to ANALYZE the table and produce new statistics, because it won't
touch changes_since_analyze. I wonder if we should simply keep the stats if no rewrite is required. Aren't the
statisticalproperties of binary-compatible types also compatible? Alternatively, we should consider bumping
changes_since_analyzein this case too, if you're going to do it in the rewrite case.<br /><br />-- <br />Thomas
Munro<br/><a href="http://www.enterprisedb.com">http://www.enterprisedb.com</a></div>