Thread: How to find size of a table

How to find size of a table

From
Tom Robinson
Date:
Kia ora, hi, folks

I'm a PostgreSQL novice, having just installed it yesterday.

I've loaded a subset of a 2G flat file into my new database so I
can estimate the size when I've finished - but:

How do I display the size (space used on the disk) of a table or
database?

Cheers

Re: How to find size of a table

From
Tom Robinson
Date:
Jason replied to me off-list:

>>How do I display the size (space used on the disk) of a table or
>>database?

>The actual tables and index files are located in the
>PGSQL_HOME/data/base directory, in separate directories for each
>database you create.
>
>I am unaware of any internal Postgres function which will do this,
>there maybe something in the newer versions perhaps.

I took a snapshot of the directories under base, used the createdb command, and the new directory which appeared was
thenew database. 

I then used the Unix du command to see how much space it used.

Cheers
--
He is a fool who has forgotten what became of his ancestry seven generations before him and who does not care what will
becomeof his progeny seven generations after him -- Kazakh Proverb