Hi, I agree on removing RELKIND_TOASTVALUE. A toast table has no restorable stats, so we should not attempt to preserve the stats here. Also, main relation and toast drifting in stats already happens. We are not introducing any issue here, AFAICT.
> if (rel->rd_rel->relkind == RELKIND_RELATION || > - rel->rd_rel->relkind == RELKIND_TOASTVALUE || > rel->rd_rel->relkind == RELKIND_MATVIEW) One thing is CREATE INDEX, mentioned in the subject, never calls index_update_stats() on the toast relation, so the toast stats are not updated by it. This will only be called when the toast's own index is rebuilt, i.e. REINDEX, VACUUM FULL, CLUSTER, REPACK. +1 on backpatching to v18. -- Sami Imseih Amazon Web Services (AWS)
