I'm trying to move a database from server1
to server2
. I read docummentation of postgres, and I think everything is right except that after I dumped db from server1 moved it and restored on server2 the sizes are different.
Server1
SELECT pg_size_pretty(pg_database_size('db_name'));
pg_size_pretty
----------------
118 MB
(1 row)
Server2
select pg_size_pretty(pg_database_size('db_name'));
pg_size_pretty
----------------
81 MB
(1 row)
I've made the dump with -a -Fc -Z9
flags and restore with pg_restore -U user -c -d db_name dump_file.dump
My questions are:
- Why the sizes are different?
- What is the correct approach to move a database like this if the application that access the db is a rails one? (I mean, I want a restore that doesn't affect future rails migrations)
- Do you have other ideas? Other docummentation that I can read?
Thank you for reading this.