Skip site navigation (1) Skip section navigation (2)

pg_database_size() and actual disk space usage

From: Alexander Fortin <alexander(dot)fortin(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: pg_database_size() and actual disk space usage
Date: 2012-03-29 09:36:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Hi folks,

I'm analyizing why our /var/lib/postgresql partition got a quick bump in
usage (from 32GB to 41GB) few days ago, even if, according to data from
monitoring software, database size kept increasing with no bump at all.

So I'm using "SELECT pg_database_size('mydb')" but I can't find much
documentation about what that "size" actually refers to. What I see is
that both the master and the replicas shows the same number (32GB), but
for both of those I see differences in the actual file system usage:

41G     /var/lib/postgresql/9.1/main/base

37G     /var/lib/postgresql/9.1/main/base/

Does pg_database_size() return size occupied by indexes too? If not, the
difference could be due to index space I guess.


Alexander Fortin


pgsql-admin by date

Next:From: RaghavendraDate: 2012-03-29 09:41:29
Subject: Re: pg_database_size() and actual disk space usage
Previous:From: superman0920Date: 2012-03-29 03:22:36
Subject: about encoding

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group