PostgreSQL, where is my analyze_new_cluster script?
Usually, once you upgraded Postgres clusters, you would need to run ANALYZE
on the whole cluster to make sure that the database statistics are up to date.
Because you know that not doing it will make your database performance go
VERY bad.
And if you use pg_upgrade
to perform the upgrade, there is a tiny little
script you can call to do this analyze process, named analyze_new_cluster.sh
in Linux and Unix environment and analyze_new_cluster.bat
in Windows.
It is useful if you use automation system, such as Ansible, because you just
need to call this tiny little thing.
But, the script is no longer there if you upgraded to PostgreSQL 14. Yes, the file is removed.[1]
Why? Because that file only contains some comments and one other line
calling vacuumdb
command.
So, if you have a playbook, Ansible playbook or simple script, calling
this file, remember to change it to vacuumdb --all --analyze-in-stages
for upgrading to Postgres 14.
[]