psql show dbsize? - Mailing list pgsql-hackers

From andy
Subject psql show dbsize?
Date
Msg-id 4728CE43.4040708@squeakycode.net
Whole thread Raw
Responses Re: psql show dbsize?
Re: psql show dbsize?
List pgsql-hackers
I know its way too late in the game, sorry, but it's a very small patch...

I was wondering if this could be added to 8.3: it adds the dbsize to \l
in psql.

It looks like this:

              List of databases
    Name    |  Owner   | Encoding | Dbsize
-----------+----------+----------+---------
  andy      | andy     | LATIN1   | 4255 kB
  cramd     | andy     | LATIN1   | 526 MB
  postgres  | postgres | LATIN1   | 4263 kB
  template0 | postgres | LATIN1   | 4136 kB
  template1 | postgres | LATIN1   | 4255 kB
(5 rows)


pretty nice, huh?

-Andy
--- src/bin/psql/describe.orig    2007-10-31 13:37:04.130331740 -0500
+++ src/bin/psql/describe.c    2007-10-31 13:37:07.130371448 -0500
@@ -400,6 +400,9 @@
     appendPQExpBuffer(&buf,
             ",\n       pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\"",
                       _("Encoding"));
+    appendPQExpBuffer(&buf,
+            ",\n       pg_size_pretty(pg_database_size(d.oid))  as \"%s\"",
+                      _("Dbsize"));
     if (verbose)
     {
         appendPQExpBuffer(&buf,

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Postgresql 8.3 beta crash
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] AutoVacuum Behaviour Question