Facendo l’aggiornamento di release di postgresql dalla 13.9 alla 15.2, in ambiente AWS,bisogna rifare le statistiche delle tabelle: ho cercato in giro se fosse possibile in maniera automatica, ma alla fine ho realizzato uno script per aggiornare le info:
schemas=psql -t -A -U USER -h IP_ADD DATABASE -c "select schema_name from information_schema.schemata"
for schema in $schemas
do
psql -t -A -U USER -h IP_ADD DATABASE -c "select format('analyse verbose %I.%I;', n.nspname::varchar, t.relname::varchar) FROM pg_class t JOIN pg_namespace n ON n.oid = t.relnamespace WHERE t.relkind = 'r' and n.nspname::varchar = '$schema' order by 1" | psql -U USER -h IP_ADD DATABASE
done
