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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

psql show dbsize?



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,


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group