Re: Postgres Database size

From: Naz Gassiep <naz(at)mira(dot)net>
To: Reece Hart <reece(at)harts(dot)net>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>, Mageshwaran <j_mageshwaran(at)sifycorp(dot)com>
Subject: Re: Postgres Database size
Date: 2007-03-19 07:13:07
Message-ID: 45FE3803.6010107@mira.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I have been looking for such a function. Having Just upgraded to 8.2,
this function is a very welcome addition to my arsenal of tools.<br>
Many thanks!<br>
- Naz.<br>
<br>
Reece Hart wrote:
<blockquote cite="mid1174180457(dot)4867(dot)23(dot)camel(at)snafu(dot)site" type="cite">
<pre wrap="">On Sun, 2007-03-18 at 00:40 +0530, Mageshwaran wrote:
</pre>
<blockquote type="cite">
<pre wrap="">how to find the size of a particular database in postgres...
</pre>
</blockquote>
<pre wrap=""><!---->
The old way was to use du or similar. Recent versions (I believe &gt;=8.1,
but check the release notes to be sure) provide several useful functions
for this:
pg_column_size
pg_database_size
pg_relation_size
pg_size_pretty
pg_tablespace_size
pg_total_relation_size

For example:

rkh(at)csb-dev=&gt; select datname,pg_size_pretty(pg_database_size(oid)) from
pg_database ;
datname | pg_size_pretty
-----------------------------+----------------
postgres | 3905 kB
csb | 113 GB
template0 | 3840 kB
csb-dev | 124 GB
csb-dev-snapshot-2007-03-08 | 123 GB
csb_02_02_2007 | 121 GB
template1 | 3840 kB

</pre>
</blockquote>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.4 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gloria Rodriguez 2007-03-19 09:00:11 Re: java.net.SocketException: Connection reset
Previous Message ab 2007-03-19 05:58:25 cache - timing