I want to upgrade a large PostgreSQL database using the following command:
docker-compose exec db pg_dumpall -U app | docker-compose exec -T db16 psql -U app
I expected the upgrade to require roughly twice the current database size, but it seems to need significantly more space than anticipated. Currently, there are 161 GB of available space, and the database occupies 123 GB, which should have left sufficient free space. However, I encountered an issue where I ran out of space.
Is there any way to optimize the upgrade process to reduce the amount of additional space required?
vacuum full
?