Database size different on Primary and Standby?

From: "Hilbert, Karin" <ioh1(at)psu(dot)edu>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Database size different on Primary and Standby?
Date: 2023-01-18 23:09:13
Message-ID: MN2PR02MB6829B5EC7F70762F6136DC6789C79@MN2PR02MB6829.namprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I manage some PostgreSQL clusters on Linux. We have a Primary & two Standby servers & for Production, there is also a DR server. We use repmgr for our HA solution & the Standbys are cloned from the Primary using the repmgr standby clone command.

My manager asked for a report of all the user databases & their sizes for each server in the cluster.
I used the psql "\l+" command & then extracted the database name & the size from the output.
I expected the databases to be the same size on the Standbys as on the Primary, but I found that some of the databases were smaller on the Standby servers than on the Primary.

For example, the output on the Primary for one of the user databases showed as: 8997 kB, but on the Standbys, it was 8849 kB.

I even dropped the database on the Primary & then restored it from a backup. Then checked the sizes again & they still showed the difference.

I also found that the template1 database on the Primary was 7821 kB, but on the Standbys, it was 7673 kB.
Is this normal? Why would the sizes be different?

Thanks,
Karin Hilbert
Database Administration
Pennsylvania State University

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Erik Wienhold 2023-01-18 23:50:19 Re: Database size different on Primary and Standby?
Previous Message Rob Sargent 2023-01-18 20:45:00 Re: Tools for moving normalized data around