Обсуждение: Querying database size

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

Querying database size

От
"Benjamin Krajmalnik"
Дата:
Is there a query which can be issued which will return the size of a
database?
I see that in pgadmin you can get the values on a per table manner.
I have looced at the pg_catalog schema, but to be truthful I cannot
figure out how to get that information.

TIA,

Benjamin

Re: Querying database size

От
"Chris Hoover"
Дата:


On 7/7/06, Benjamin Krajmalnik <kraj@illumen.com> wrote:
Is there a query which can be issued which will return the size of a
database?
I see that in pgadmin you can get the values on a per table manner.
I have looced at the pg_catalog schema, but to be truthful I cannot
figure out how to get that information.

TIA,

Benjamin

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


select datname, pg_database_size(datname) from pg_database;

This assumes your are running 8.x (might be 8.1.x).

chris

Re: Querying database size

От
Jeff Frost
Дата:
If you have 8.1.x you can do something like this:

SELECT pg_size_pretty(database_size('<database name>'));

example:

SELECT pg_size_pretty(database_size('testdb'));

If you have another version of postgres, check out the dbsize contrib module.


On Fri, 7 Jul 2006, Benjamin Krajmalnik wrote:

> Is there a query which can be issued which will return the size of a
> database?
> I see that in pgadmin you can get the values on a per table manner.
> I have looced at the pg_catalog schema, but to be truthful I cannot
> figure out how to get that information.
>
> TIA,
>
> Benjamin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
>

--
Jeff Frost, Owner     <jeff@frostconsultingllc.com>
Frost Consulting, LLC     http://www.frostconsultingllc.com/
Phone: 650-780-7908    FAX: 650-649-1954