I have a PostgreSQL v10 database with a size of about 100GB.
What is the most efficient (fastest) way to rebuild statistics, for example after a major version upgrade?
ANALYZE
with no parameters updates statistics for then entire database by default — it's painfully slow! This seems like a single process.
Is there any way to parallelize this to speed it up?
You could use
vacuumdb
with the same options thatpg_upgrade
suggests:The documentation describes what it does:
To calculate statistics with several parallel processes, you can use the option
-j
ofvacuumdb
.