Thread: Change in db size

Change in db size

From
Sonam Sharma
Date:
I have restored database and the db size of source was around 55gb and after restore the db size of Target is 47gb.

How to confirm if restore was successful or not ?
The table count is also same.

Re: Change in db size

From
"David G. Johnston"
Date:
On Wed, Jul 17, 2019 at 10:03 AM Sonam Sharma <sonams1209@gmail.com> wrote:
I have restored database and the db size of source was around 55gb and after restore the db size of Target is 47gb.

You haven't described how you restored the database but measuring size doesn't work because typically restoring a table causes it to be (nearly?) bloat free while a long running system will accumulate bloat.
 
How to confirm if restore was successful or not ?

A lack of error messages is a good primary indicator.
 
The table count is also same.

Good.

Beyond that you need to decide what amount of internal data validation you can live with.  It also depends on whether you have expected numbers based upon the data being restored.

David J.

Re: [External] Change in db size

From
Vijaykumar Jain
Date:
I guess the restore cleared the bloat from the table.
\dt+
\di+
If you run the above commands from the terminal, you would see diff in sizes of the. objects.
Also querying pg_stat_all_tables you might see  “dead” tuples in old tables which would have cleaned up now.
Also if there were any large temp objects or queries using temp files would have cleared and hence reclaimed disk.
If none of these are true, then I guess experts would pitch in.

On Wed, 17 Jul 2019 at 10:33 PM Sonam Sharma <sonams1209@gmail.com> wrote:
I have restored database and the db size of source was around 55gb and after restore the db size of Target is 47gb.

How to confirm if restore was successful or not ?
The table count is also same.
--

Regards,
Vijay

Re: Change in db size

From
Sonam Sharma
Date:
I took the backup using pg_dump with gzip option and restored it with psql.

On Wed, Jul 17, 2019, 10:39 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wed, Jul 17, 2019 at 10:03 AM Sonam Sharma <sonams1209@gmail.com> wrote:
I have restored database and the db size of source was around 55gb and after restore the db size of Target is 47gb.

You haven't described how you restored the database but measuring size doesn't work because typically restoring a table causes it to be (nearly?) bloat free while a long running system will accumulate bloat.
 
How to confirm if restore was successful or not ?

A lack of error messages is a good primary indicator.
 
The table count is also same.

Good.

Beyond that you need to decide what amount of internal data validation you can live with.  It also depends on whether you have expected numbers based upon the data being restored.

David J.

Re: Change in db size

From
Luca Ferrari
Date:
On Wed, Jul 17, 2019 at 7:33 PM Sonam Sharma <sonams1209@gmail.com> wrote:
>
> I took the backup using pg_dump with gzip option and restored it with psql.

It does not change the way you backed up, chances are when you
restored it the database cropped table and index bloating as already
mentioned.
The other, remote chance, is that you did not backed up all the
objects, so in this case you should show us your backup command line
(and restore one too), and also the output of commands like \l+, \dt+,
\di+ and differences you have found.

Luca