pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feeddatabase size changed after restoring using pg_restore
3+ messages / 3 participants
[nested] [flat]
* database size changed after restoring using pg_restore
@ 2017-11-08 22:59 Dylan Luong <Dylan.Luong@unisa.edu.au>
2017-11-08 23:23 ` Re: database size changed after restoring using pg_restore Andreas Joseph Krogh <andreas@visena.com>
2017-11-08 23:24 ` Re: database size changed after restoring using pg_restore John R Pierce <pierce@hogranch.com>
0 siblings, 2 replies; 3+ messages in thread
From: Dylan Luong @ 2017-11-08 22:59 UTC (permalink / raw)
To: pgsql-general
Hi
I am upgrading some databases from a PostgreSQL 9.2 server to a new PostgreSQL 9.6 server.
I used pg_dump and pg_restore for the upgrade.
This is the command I used to dump the database. I ran the command from the 9.6 server.
pg_dump -h 9.2server -j 16 --format=directory -f /pg_backup/backup/dump/mydb-20171108.dmp -U postgres -W mydb
This is the command I used to restore the database on the 9.6server.
pg_restore -j 16 -C -d postgres /pg_backup/backup/dump/mydb-20171108.dmp
Everything appears ok, the dump and restore completed without and errors.
But when I listed the size of the database (postgres=# \l+) between the 9.2 and the upgraded 9.6, they were different.
on 9.2 it was 3776 MB
on 9.6 it was 1570 MB
I also did a few more databases using the same steps and they all appeared to be smaller. Is that normal?
Regards
Dylan
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: database size changed after restoring using pg_restore
2017-11-08 22:59 database size changed after restoring using pg_restore Dylan Luong <Dylan.Luong@unisa.edu.au>
@ 2017-11-08 23:23 ` Andreas Joseph Krogh <andreas@visena.com>
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Joseph Krogh @ 2017-11-08 23:23 UTC (permalink / raw)
To: pgsql-general
På onsdag 08. november 2017 kl. 23:59:40, skrev Dylan Luong <
Dylan.Luong@unisa.edu.au <mailto:Dylan.Luong@unisa.edu.au>>:
Hi
I am upgrading some databases from a PostgreSQL 9.2 server to a new
PostgreSQL 9.6 server.
I used pg_dump and pg_restore for the upgrade.
This is the command I used to dump the database. I ran the command from the
9.6 server.
pg_dump -h 9.2server -j 16 --format=directory -f
/pg_backup/backup/dump/mydb-20171108.dmp -U postgres -W mydb
This is the command I used to restore the database on the 9.6server.
pg_restore -j 16 -C -d postgres /pg_backup/backup/dump/mydb-20171108.dmp
Everything appears ok, the dump and restore completed without and errors.
But when I listed the size of the database (postgres=# \l+) between the 9.2
and the upgraded 9.6, they were different.
on 9.2 it was 3776 MB
on 9.6 it was 1570 MB
I also did a few more databases using the same steps and they all appeared to
be smaller. Is that normal?
Yep.
-- Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas@visena.com <mailto:andreas@visena.com>
www.visena.com <https://www.visena.com;
<https://www.visena.com;
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: database size changed after restoring using pg_restore
2017-11-08 22:59 database size changed after restoring using pg_restore Dylan Luong <Dylan.Luong@unisa.edu.au>
@ 2017-11-08 23:24 ` John R Pierce <pierce@hogranch.com>
1 sibling, 0 replies; 3+ messages in thread
From: John R Pierce @ 2017-11-08 23:24 UTC (permalink / raw)
To: pgsql-general
On 11/8/2017 2:59 PM, Dylan Luong wrote:
>
> Hi
>
> I am upgrading some databases from a PostgreSQL 9.2 server to a new
> PostgreSQL 9.6 server.
>
> I used pg_dump and pg_restore for the upgrade.
>
> .....
>
> But when I listed the size of the database (postgres=# \l+) between
> the 9.2 and the upgraded 9.6, they were different.
>
> on 9.2 it was 3776 MB
> on 9.6 it was 1570 MB
>
> I also did a few more databases using the same steps and they all
> appeared to be smaller. Is that normal?
yes. a freshly restored database will be all contiguous with no
embedded free tuples left over from operations. databases that get
updates (or inserts/deletes) tend to bloat.
--
john r pierce, recycling bits in santa cruz
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2017-11-08 23:24 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 22:59 database size changed after restoring using pg_restore Dylan Luong <Dylan.Luong@unisa.edu.au>
2017-11-08 23:23 ` Andreas Joseph Krogh <andreas@visena.com>
2017-11-08 23:24 ` John R Pierce <pierce@hogranch.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox