>
> at the *actual size* of the relation and takes that into account when
> scaling the statistics (see table_block_relation_estimate_size() in
> tableam.c). If the table sizes don't match between the two servers
> then there's no guarantees the planner will produce the same plan.
>
Sorry that I didn't see this thread until now. I would like to note that
table_block_relation_estimate_size() determines the actual size of the
relation by asking pg_class, and the relevant values there are set by
pg_restore_relation_stats().