Thread: DB size difference after restore

DB size difference after restore

From
Sonam Sharma
Date:
I have restored the database from backup dump but the size of source and target databases are different. What can be the reason for this ?

Regards,
Sonam

Re: DB size difference after restore

From
Benjamin Scherrey
Date:
If you're talking about space on drive then you can expect the new one to be smaller generally as it has been straight efficient writes rather than a bunch of updates and deletes which create "holes" in the physical file space.

It helps if you are more detailed as to what you've observed if you want a more specific answer. 

  - - Ben Scherrey 

On Wed, Oct 3, 2018, 7:43 PM Sonam Sharma <sonams1209@gmail.com> wrote:
I have restored the database from backup dump but the size of source and target databases are different. What can be the reason for this ?

Regards,
Sonam

Re: DB size difference after restore

From
Sonam Sharma
Date:
Hello Ben,

When we do \l+ , it is different than sourcewhen we load backup from target server


Regards,

Sonam


 

 


On Wed, Oct 3, 2018 at 6:17 PM Benjamin Scherrey <scherrey@proteus-tech.com> wrote:
If you're talking about space on drive then you can expect the new one to be smaller generally as it has been straight efficient writes rather than a bunch of updates and deletes which create "holes" in the physical file space.

It helps if you are more detailed as to what you've observed if you want a more specific answer. 

  - - Ben Scherrey 

On Wed, Oct 3, 2018, 7:43 PM Sonam Sharma <sonams1209@gmail.com> wrote:
I have restored the database from backup dump but the size of source and target databases are different. What can be the reason for this ?

Regards,
Sonam

Re: DB size difference after restore

From
Fabio Pardi
Date:
Hi Sonam,

it is common that after an export (pg_dump) and a consecutive import, the new database uses less space than the old one.

Under some circumstances, indexes can become unbalanced or bloated, and tables bloated. And that uses more space than it should.

for the sake of trying it out: If you perform a 'vacuum full' on your old db, then the size should be very close or equal to the newly imported one.

hope it clarifies.


regards,

fabio pardi


On 03/10/18 14:51, Sonam Sharma wrote:
Hello Ben,

When we do \l+ , it is different than sourcewhen we load backup from target server


Regards,

Sonam


 

 


On Wed, Oct 3, 2018 at 6:17 PM Benjamin Scherrey <scherrey@proteus-tech.com> wrote:
If you're talking about space on drive then you can expect the new one to be smaller generally as it has been straight efficient writes rather than a bunch of updates and deletes which create "holes" in the physical file space.

It helps if you are more detailed as to what you've observed if you want a more specific answer. 

  - - Ben Scherrey 

On Wed, Oct 3, 2018, 7:43 PM Sonam Sharma <sonams1209@gmail.com> wrote:
I have restored the database from backup dump but the size of source and target databases are different. What can be the reason for this ?

Regards,
Sonam

Re: DB size difference after restore

From
Sonam Sharma
Date:


On Wed, Oct 3, 2018 at 6:21 PM Sonam Sharma <sonams1209@gmail.com> wrote:
Hello Ben,

When we do \l+ , it is different than sourcewhen we load backup from target server.

   Backup is taken using pg_dump  and its loaded as psql db name <backup> 


Regards,

Sonam


 

 


On Wed, Oct 3, 2018 at 6:17 PM Benjamin Scherrey <scherrey@proteus-tech.com> wrote:
If you're talking about space on drive then you can expect the new one to be smaller generally as it has been straight efficient writes rather than a bunch of updates and deletes which create "holes" in the physical file space.

It helps if you are more detailed as to what you've observed if you want a more specific answer. 

  - - Ben Scherrey 

On Wed, Oct 3, 2018, 7:43 PM Sonam Sharma <sonams1209@gmail.com> wrote:
I have restored the database from backup dump but the size of source and target databases are different. What can be the reason for this ?

Regards,
Sonam

Re: DB size difference after restore

From
Chris Travers
Date:


On Wed, Oct 3, 2018 at 2:59 PM Sonam Sharma <sonams1209@gmail.com> wrote:


On Wed, Oct 3, 2018 at 6:21 PM Sonam Sharma <sonams1209@gmail.com> wrote:
Hello Ben,

When we do \l+ , it is different than sourcewhen we load backup from target server.

   Backup is taken using pg_dump  and its loaded as psql db name <backup> 

It's normal that there is a size difference.

Basically you have a database you dump which may have many versions of visible rows or may have free space in the table, etc.

You take the most recent consistent backup of the visible data when you take a dump.

You create a database with only that information in it.  So one generally expects it to be smaller.  In for a db of reasonable size and load the difference may be 2x or more.

 


Regards,

Sonam


 

 


On Wed, Oct 3, 2018 at 6:17 PM Benjamin Scherrey <scherrey@proteus-tech.com> wrote:
If you're talking about space on drive then you can expect the new one to be smaller generally as it has been straight efficient writes rather than a bunch of updates and deletes which create "holes" in the physical file space.

It helps if you are more detailed as to what you've observed if you want a more specific answer. 

  - - Ben Scherrey 

On Wed, Oct 3, 2018, 7:43 PM Sonam Sharma <sonams1209@gmail.com> wrote:
I have restored the database from backup dump but the size of source and target databases are different. What can be the reason for this ?

Regards,
Sonam


--
Best Wishes,
Chris Travers

Efficito:  Hosted Accounting and ERP.  Robust and Flexible.  No vendor lock-in.