As far as I understand relpages and reltuples are set only when you perform "analyze" of the table.
Also autovacuum's autoanalyze.
When it happen? I have created normal table, populated it with some data and then wait several hours but pg_class was not updated for this table.
heap_vacuum_rel() in src/backend/access/heap/vacuumlazy.c below
* Update statistics in pg_class.
which I'm pretty sure is common to explicit vacuum and autovacuum. I haven't run up a test to verify 100% but most DBs would never have relpages etc set if autovac didn't do it since most aren't explicitly VACUUMed at all.
I thought it was done when autovac ran an analyze, but it looks like it's all autovac. Try setting very aggressive autovac thresholds and inserting + deleting a bunch of tuples maybe.
I attach to this mail slightly refactored versions of this patches with fixes of issues reported in your review.
Thanks.
Did you have a chance to consider my questions too? I see a couple of things where there's no patch change, which is fine, but I'd be interested in your thoughts on the question/issue in those cases.