Обсуждение: how to know the current size of a database

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

how to know the current size of a database

От
son@raider.co.nz
Дата:
Hello

I want to know about the size of my database. For example, I want to know
how many Mb of data for current myDatabase database in a postgres server.

How I can do that?
Thanks



Re: how to know the current size of a database

От
"A. Kretschmer"
Дата:
am  Wed, dem 19.09.2007, um 22:36:02 +1200 mailte son@raider.co.nz folgendes:
> Hello
>
> I want to know about the size of my database. For example, I want to know
> how many Mb of data for current myDatabase database in a postgres server.

http://www.postgresql.org/docs/8.1/interactive/functions-admin.html
Table 9-47. Database Object Size Functions


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: how to know the current size of a database

От
Farhan Mughal
Дата:

>>I want to know about the size of my database. For example, I want to know
>>how many Mb of data for current myDatabase database in a postgres server.

>>How I can do that?

Try the following query:
select pg_size_pretty(pg_database_size('<DATABASE NAME>'));

--Farhan



----- Original Message ----
From: "son@raider.co.nz" <son@raider.co.nz>
To: pgsql-general@postgresql.org
Sent: Wednesday, 19 September, 2007 3:36:02 PM
Subject: [GENERAL] how to know the current size of a database

Hello

I want to know about the size of my database. For example, I want to know
how many Mb of data for current myDatabase database in a postgres server.

How I can do that?
Thanks



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq



Yahoo! Answers - Get better answers from someone who knows. Try it now.

Re: how to know the current size of a database

От
Decibel!
Дата:
On Sep 19, 2007, at 5:36 AM, son@raider.co.nz wrote:
> I want to know about the size of my database. For example, I want
> to know
> how many Mb of data for current myDatabase database in a postgres
> server.

If you don't need an exact size, this query will be a lot faster than
the size functions:

SELECT pg_size_pretty(sum(relpages)*8192) FROM pg_class;
--
Decibel!, aka Jim C. Nasby, Database Architect  decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828



Re: how to know the current size of a database

От
"D. Dante Lorenso"
Дата:
son@raider.co.nz wrote:
> I want to know about the size of my database. For example, I want to know
> how many Mb of data for current myDatabase database in a postgres server.

SELECT pg_size_pretty(pg_database_size(current_database()));

-- Dante