Midhun Pottammal
Midhun Pottammal

Reputation: 1139

Is database back up size is same as database size

am working with PostgreSQL i checked following command then it returns 12MB

SELECT pg_size_pretty(pg_database_size('itcs'));

but when i took back up using pgadmin back up size is 1MB why this difrence

Upvotes: 1

Views: 1508

Answers (1)

Thilo
Thilo

Reputation: 262504

If you are taking a logical backup (with pg_dump), the backup contains only the data, no empty pages, no old versions of rows, no padding, no indexes. It may also be compressed. All that can greatly reduce the size.

If you are taking a physical backup, the backup more or less consists of the actual database files as they are, plus recovery logs to get them to a consistent state. So that would be roughly the same size as the database itself (but you can also compress it).

Upvotes: 1

Related Questions