Обсуждение: dbsize command

Поиск
Список
Период
Сортировка

dbsize command

От
"Reynolds, Gregory A"
Дата:

In past versions there was a contrib/dbsize command that would tell you how much storage space was being taken by a table. Is that is still a supported feature in 8.3, and if so what is the syntax or where is the documentation on how to use it?

 

Greg Reynolds

Re: dbsize command

От
Greg Smith
Дата:
On Mon, 23 Jun 2008, Reynolds, Gregory A wrote:

> In past versions there was a contrib/dbsize command that would tell you
> how much storage space was being taken by a table. Is that is still a
> supported feature in 8.3, and if so what is the syntax or where is the
> documentation on how to use it?

The low-level functions are documented at
http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-DBSIZE

Check out http://wiki.postgresql.org/wiki/Disk_Usage for some samples of
how to actually use them.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

Re: dbsize command

От
Brad Nicholson
Дата:
On Mon, 2008-06-23 at 10:50 -0700, Reynolds, Gregory A wrote:
> In past versions there was a contrib/dbsize command that would tell
> you how much storage space was being taken by a table. Is that is
> still a supported feature in 8.3, and if so what is the syntax or
> where is the documentation on how to use it?

There are a series of functions in the database core that will tell you
this now.

http://www.postgresql.org/docs/8.3/interactive/functions-admin.html

--
Brad Nicholson  416-673-4106
Database Administrator, Afilias Canada Corp.


Re: dbsize command

От
salman
Дата:
Brad Nicholson wrote:
> On Mon, 2008-06-23 at 10:50 -0700, Reynolds, Gregory A wrote:
>> In past versions there was a contrib/dbsize command that would tell
>> you how much storage space was being taken by a table. Is that is
>> still a supported feature in 8.3, and if so what is the syntax or
>> where is the documentation on how to use it?
>
> There are a series of functions in the database core that will tell you
> this now.
>
> http://www.postgresql.org/docs/8.3/interactive/functions-admin.html
>

This is what I use: SELECT
pg_size_pretty(pg_database_size(current_database()));

Found it a while back on pg-general.

-salman

Re: dbsize command

От
"Leif B. Kristensen"
Дата:
On Monday 23. June 2008, salman wrote:

>This is what I use: SELECT
>pg_size_pretty(pg_database_size(current_database()));

Great, I remember that I saw it, but couldn't remember the command. Now
I've made a function:

CREATE OR REPLACE FUNCTION db_size() RETURNS TEXT AS $$
    SELECT pg_size_pretty(pg_database_size(current_database()));
$$ LANGUAGE sql STABLE;

pgslekt=> select db_size();
 db_size
---------
 63 MB
(1 row)

--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE
My Jazz Jukebox: http://www.last.fm/user/leifbk/