dbsize contrib

Started by Andreas Pflugalmost 22 years ago7 messagespatches
Jump to latest
#1Andreas Pflug
pgadmin@pse-consulting.de

The current implementation of dbsize doesn't handle tables in
tablespaces correctly, and is quite restricted on objects covered (only
tables and databases, but not tablespaces and indexes).

The attached patch contributes:

- database_size(name)
- relation_size(text)
These are the well-known functions, tablespace-aware.

- pg_tablespace_size(oid)
- pg_database_size(oid)
- pg_relation_size(oid)
Tablespace-aware implementations, used by the upper functions.
pg_relation_size will report sizes of indexes as well.

- pg_size_pretty(bigint)
Formatting of sizes, to display '146MB' instead of '152885668'

Regards,
Andreas

Attachments:

dbsize.difftext/x-patch; name=dbsize.diffDownload+282-123
#2Gavin Sherry
swm@linuxworld.com.au
In reply to: Andreas Pflug (#1)
Re: dbsize contrib

On Sun, 29 Aug 2004, Andreas Pflug wrote:

The current implementation of dbsize doesn't handle tables in
tablespaces correctly, and is quite restricted on objects covered (only
tables and databases, but not tablespaces and indexes).

The attached patch contributes:

- database_size(name)
- relation_size(text)

I sent in a dbsize patch to make these functions tablespace aware...

These are the well-known functions, tablespace-aware.

- pg_tablespace_size(oid)
- pg_database_size(oid)
- pg_relation_size(oid)
Tablespace-aware implementations, used by the upper functions.
pg_relation_size will report sizes of indexes as well.

- pg_size_pretty(bigint)
Formatting of sizes, to display '146MB' instead of '152885668'

Nice.

Gavin

#3Andreas Pflug
pgadmin@pse-consulting.de
In reply to: Gavin Sherry (#2)
Re: dbsize contrib

Gavin Sherry wrote:

The attached patch contributes:

- database_size(name)
- relation_size(text)

I sent in a dbsize patch to make these functions tablespace aware...

AFAIR your patch was applied, but it misses tables in non-default
tablespaces.

Regards,
Andreas

#4Gavin Sherry
swm@linuxworld.com.au
In reply to: Andreas Pflug (#3)
Re: dbsize contrib

On Mon, 30 Aug 2004, Andreas Pflug wrote:

Gavin Sherry wrote:

The attached patch contributes:

- database_size(name)
- relation_size(text)

I sent in a dbsize patch to make these functions tablespace aware...

AFAIR your patch was applied, but it misses tables in non-default
tablespaces.

Ahh. There is a thoughto in my patch. The ifdef should have been
HAVE_SYMLINK not SYMLINK. With HAVE_SYMLINK the current code works fine.

That being said, your patch seems to clean up the code some whilst adding
more functionality.

Gavin

#5Bruce Momjian
bruce@momjian.us
In reply to: Andreas Pflug (#1)
Re: dbsize contrib

Patch applied. Thanks.

Can I get some documentation in the README for all the new
functionality.

---------------------------------------------------------------------------

Andreas Pflug wrote:

The current implementation of dbsize doesn't handle tables in
tablespaces correctly, and is quite restricted on objects covered (only
tables and databases, but not tablespaces and indexes).

The attached patch contributes:

- database_size(name)
- relation_size(text)
These are the well-known functions, tablespace-aware.

- pg_tablespace_size(oid)
- pg_database_size(oid)
- pg_relation_size(oid)
Tablespace-aware implementations, used by the upper functions.
pg_relation_size will report sizes of indexes as well.

- pg_size_pretty(bigint)
Formatting of sizes, to display '146MB' instead of '152885668'

Regards,
Andreas

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#6Andreas Pflug
pgadmin@pse-consulting.de
In reply to: Bruce Momjian (#5)
Re: dbsize contrib

Bruce Momjian wrote:

Patch applied. Thanks.

Can I get some documentation in the README for all the new
functionality.

Here it is.

Regards,
Andreas

Attachments:

dbsizedoc.difftext/x-patch; name=dbsizedoc.diffDownload+43-7
#7Bruce Momjian
bruce@momjian.us
In reply to: Andreas Pflug (#6)
Re: dbsize contrib

Applied and new file attached. I cleaned it up a little. One problem
is that the sample query generates a syntax error.

---------------------------------------------------------------------------

Andreas Pflug wrote:

Bruce Momjian wrote:

Patch applied. Thanks.

Can I get some documentation in the README for all the new
functionality.

Here it is.

Regards,
Andreas

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/pgtop/contrib/dbsize/README.dbsizetext/plainDownload