PostgreSQL v18 introduces the ability to preserve optimizer statistics during major upgrades, enhancing performance and reducing downtime. This feature allows users to export optimizer statistics with `pg_dump` and ensures that statistics remain intact when using `pg_upgrade`, streamlining database upgrades.
Understanding when to rebuild PostgreSQL indexes is crucial for maintaining database performance. The decision depends on index type, bloat levels, and performance metrics, with recommendations to use the `pgstattuple` extension to assess index health before initiating a rebuild. Regular automatic rebuilds are generally unnecessary and can waste resources.