Re: pgdump and restore results in different sizes DB

From: Elvis Flesborg <elfle(at)sdfe(dot)dk>
To: "Michaeldba(at)sqlexec(dot)com" <Michaeldba(at)sqlexec(dot)com>, "Jean R(dot) Franco" <jfranco(at)maila(dot)biz>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pgdump and restore results in different sizes DB
Date: 2017-09-05 10:30:02
Message-ID: BA481260A6B9904BBA436DB43FCC012F15576775@S000014.PROD.SITAD.DK
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I had luck with this query:

`select nspname, relname, reltuples from pg_class left join pg_namespace on pg_namespace.oid = pg_class.relnamespace;`

If you want, you can throw an `order by nspname, relname` in there, then it will be easier to compare the two clusters.

-Elvis

From: pgsql-admin-owner(at)postgresql(dot)org [mailto:pgsql-admin-owner(at)postgresql(dot)org] On Behalf Of Michaeldba(at)sqlexec(dot)com
Sent: Monday, September 4, 2017 11:53 PM
To: Jean R. Franco <jfranco(at)maila(dot)biz>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] pgdump and restore results in different sizes DB

Get approximate counts the shortcut way:
Do analyze on all your user tables. Then, do a join with pg_namespace, pg_table(s), and pg_class and spit out the scheme, table name, and number of rows(reltuples).

Not near a computer so forgot if it is pg_table or pg_table.

Sent from my iPad

On Sep 4, 2017, at 2:15 PM, Jean R. Franco <jfranco(at)maila(dot)biz<mailto:jfranco(at)maila(dot)biz>> wrote:
Thanks for replying,

That takes me to another question:
- Is there a way to do a count on all the tables at once?
I can check one by one but that will take me a long time (1596).

I checked the table sizes and they differ very much!

Thanks,

4 de Setembro de 2017 09:54, Michaeldba(at)sqlexec(dot)com<mailto:Michaeldba(at)sqlexec(dot)com> escreveu:
Do select counts from all your tables in old and new and see if they match.

Sent from my iPad

On Sep 4, 2017, at 8:36 AM, Jean R. Franco <jfranco(at)maila(dot)biz<mailto:jfranco(at)maila(dot)biz>> wrote:
Hi Michael,

Thanks for replying,

Do you think it would be that big of a size? Over 21G?

Thanks,

4 de Setembro de 2017 08:45, "Michael Vitale" <michaeldba(at)sqlexec(dot)com<mailto:%22Michael%20Vitale%22%20%3cmichaeldba(at)sqlexec(dot)com%3e>> escreveu:

nice benefit of logical dump and restore: bye bye bloat
On September 4, 2017 at 7:35 AM "Jean R. Franco" <jfranco(at)maila(dot)biz<mailto:jfranco(at)maila(dot)biz>> wrote:

Hello Everyone,

I'm moving a postgresql server from one server to another, both running versions 9.4.10
It's a single large database and I'm using pgdump to export and restoring on the new server.

The thing is, on the old server the database size is 81GB, but when I restore on the new server, it decreases to 60GB

List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
------------+----------+----------+---------+-------+-------------------+-------+------------+-------------
ecidade | postgres | LATIN1 | C | C | | 60 GB | pg_default |

I'm watching the whole process of restoring it and have no errors.
What could I been doing wrong?

Thanks,

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Carlos Augusto Machado 2017-09-05 14:05:48 Problem with transaction ID wraparound
Previous Message Peter 2017-09-05 09:21:46 database corruption on disk-full?