Skip site navigation (1) Skip section navigation (2)

Re: ]To estimate the size of db

From: Gerd Koenig <koenig(at)transporeon(dot)com>
To: Duan Ligong <l-duan(at)zd(dot)cnes(dot)jp(dot)nec(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: ]To estimate the size of db
Date: 2008-05-22 08:34:26
Message-ID: D1C294F5-82C6-43DD-A748-15011CB910BF@transporeon.com (view raw or flat)
Thread:
Lists: pgsql-admin
Hi Duan,

perhaps you can go the way via some system functions like:

## list tables and their size
SELECT    relname AS table_name,
                  pg_size_pretty(pg_relation_size(oid)) AS table_sz,
                  pg_size_pretty(pg_total_relation_size(oid)) AS  
total_sz
        FROM      pg_class
        WHERE     relkind = 'r'
        ORDER BY  pg_relation_size(oid) DESC;

## list db's and size
SELECT   datname AS db_name,
                 pg_size_pretty(pg_database_size(oid)) AS db_size
        FROM     pg_database
        ORDER BY pg_database_size(oid) DESC;


hope that helps......::GERD::......

Am 22.05.2008 um 03:08 schrieb Duan Ligong:

> Hi, Scott
>
> Thanks for your reply.
>
>> There's also the old fashioned way:
>
> I mean I want to estimate the size of the space which the db will  
> occupy.
> Now there is no db.
>
>> sudo su - postgres
>> cd $PGDATA  # or wherever you point with -D on startup
>> du -sh .
>
> Regards
> Duan
> --
> Duan Ligong
> TEL   :  0561-75-1925-6201
>           800-81-569-6201
> E-Mail : l-duan(at)zd(dot)cnes(dot)jp(dot)nec(dot)com
> ----- Original Message ----- From: "Scott Marlowe"  
> <scott(dot)marlowe(at)gmail(dot)com>
> To: "Duan Ligong" <l-duan(at)zd(dot)cnes(dot)jp(dot)nec(dot)com>
> Cc: <pgsql-admin(at)postgresql(dot)org>
> Sent: Thursday, May 22, 2008 4:08 AM
> Subject: Re: [ADMIN] [Admin]To estimate the size of db
>
>
>> On Wed, May 14, 2008 at 7:33 PM, Duan Ligong <l- 
>> duan(at)zd(dot)cnes(dot)jp(dot)nec(dot)com> wrote:
>>>
>>> Hi, all
>>>
>>> Is there a way to estimate the size of the space which a  
>>> postgresql database
>>> occupies? or the max size of db?
>>>
>>> I know there are a lot of factors, such as the frequency
>>> of updating, data size, which affects the size of db and it seems  
>>> difficult
>>> to estimate it precisely.
>>
>> There's also the old fashioned way:
>>
>> sudo su - postgres
>> cd $PGDATA  # or wherever you point with -D on startup
>> du -sh .
>>
>> -- 
>> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-admin
>
>
> -- 
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin


In response to

Responses

pgsql-admin by date

Next:From: Amit jainDate: 2008-05-22 13:47:45
Subject: Error while executing pg_dump "invalid memory alloc request size 4294967293"
Previous:From: Shane AmblerDate: 2008-05-22 06:34:19
Subject: Re: ]To estimate the size of db

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group