how to know the current size of a database

Started by Nonameover 18 years ago5 messagesgeneral
Jump to latest
#1Noname
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

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Noname (#1)
Re: how to know the current size of a database

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

#3Farhan Mughal
farhanhafeezmughal@yahoo.co.uk
In reply to: A. Kretschmer (#2)
Re: how to know the current size of a database

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

___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html

#4Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Noname (#1)
Re: how to know the current size of a database

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

#5D. Dante Lorenso
dante@lorenso.com
In reply to: Noname (#1)
Re: how to know the current size of a database

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