Unix Technical Forum

[Admin]To estimate the size of db

This is a discussion on [Admin]To estimate the size of db within the pgsql Admins forums, part of the PostgreSQL category; --> Hi, all Is there a way to estimate the size of the space which a postgresql database occupies? or ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-16-2008, 02:42 PM
Duan Ligong
 
Posts: n/a
Default [Admin]To estimate the size of db


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.

Regards
Duan

--
TEL : 0561-75-1925-6201
800-81-569-6201
E-Mail : l-duan@zd.cnes.jp.nec.com

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-16-2008, 02:42 PM
Jaime Casanova
 
Posts: n/a
Default Re: [Admin]To estimate the size of db

On Wed, May 14, 2008 at 8:33 PM, Duan Ligong <l-duan@zd.cnes.jp.nec.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?
>


if pg >= 8.1 then
http://www.postgresql.org/docs/8.1/s...S-ADMIN-DBSIZE
else
there is a contrib/dbsize
end if

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Guayaquil - Ecuador
Cel. (593) 087171157

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-24-2008, 07:11 AM
Scott Marlowe
 
Posts: n/a
Default Re: [Admin]To estimate the size of db

On Wed, May 14, 2008 at 7:33 PM, Duan Ligong <l-duan@zd.cnes.jp.nec.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-24-2008, 07:11 AM
Duan Ligong
 
Posts: n/a
Default Re: ]To estimate the size of db

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@zd.cnes.jp.nec.com
----- Original Message -----
From: "Scott Marlowe" <scott.marlowe@gmail.com>
To: "Duan Ligong" <l-duan@zd.cnes.jp.nec.com>
Cc: <pgsql-admin@postgresql.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@zd.cnes.jp.nec.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>



--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-24-2008, 07:11 AM
Gerd Koenig
 
Posts: n/a
Default Re: ]To estimate the size of db

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@zd.cnes.jp.nec.com
> ----- Original Message ----- From: "Scott Marlowe"
> <scott.marlowe@gmail.com>
> To: "Duan Ligong" <l-duan@zd.cnes.jp.nec.com>
> Cc: <pgsql-admin@postgresql.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@zd.cnes.jp.nec.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@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-admin

>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin



--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-24-2008, 07:11 AM
Duan Ligong
 
Posts: n/a
Default Re: ]To estimate the size of db

Hi, Gerd

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


Thank you very much and it's very helpful.

Regards
Duan

> ## 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@zd.cnes.jp.nec.com
>> ----- Original Message ----- From: "Scott Marlowe"
>> <scott.marlowe@gmail.com>
>> To: "Duan Ligong" <l-duan@zd.cnes.jp.nec.com>
>> Cc: <pgsql-admin@postgresql.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@zd.cnes.jp.nec.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@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgsql-admin

>>
>>
>> --
>> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-admin


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:57 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com