By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

need help

P: 1
hi
iam a new member and i need a help in my porject
i need to Know how can I calculate the size of DB ,meaning caculaste the size of each table?
also I need to know if the size of the database H/W is dependent or S/W is the dependent one or both are ?
and when the DB is transferred from one computer to another does its size
change?

I hope that anyone can help me I will appreciated it and thanks anyway

The Angel
Dec 10 '06 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 534
The best way to calculate the size of your tables is to use the optional module dbsize, which comes with the Postgres source code, see .../contrib/dbsize
(You may or may not have it compiled/included in your Postgres installatiuon).

The size of the database between different UNIX platforms should be about the same (that is my best guess) and I have no idea how it would compare with Windows installation.

Keep in mind that size on the disk is always larger than all your data, because database needs to maintain a lot of metadata, logs, etc.
On UNIX you can see the overall size with the `du` command:

Expand|Select|Wrap|Line Numbers
  1. % cd $PGDATA
  2. postgresql % du -h
  3. 3.6M    ./base/1
  4. 3.6M    ./base/16975
  5. 4.0K    ./base/16976/pgsql_tmp
  6. 32M     ./base/16976
  7. 39M     ./base
  8. 132K    ./global
  9. 81M     ./pg_xlog
  10. 52K     ./pg_clog
  11. 120M    .
Here it's about 120 mb

Check the man pages for options to du command supported on given platform
Also keep in mind that overall size on disk may change without any changes to your data, because of either postgres internal maintenance or some user actions
(Try running "VACUUM FULL" on your db and then run `du` again to compare)

To answer all of your questions... this takes more than just yes or now... can I ask why are you concerned with all this?
Dec 11 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.