Frequently we restore a Postgres DB from a RDS snapshot to an entirely new RDS instance. We notice that queries on certain tables perform really slowly but improve by a huge magnitude after running VACUUM ANALYZE
on those tables. Queries on those tables are performing well on the original instance. This makes me think that a restored snapshot or db doesn't bring along table statistics that are helpful to queries but thats just a guess.
Any insights on what happens to ANALYZEd
table stats when a db is restored? Are those stats not relevant because the file layout is now different for the new db and hence its always a good idea to ANALYZE
after a restore