Unix Technical Forum

Table Size

This is a discussion on Table Size within the Pgsql Performance forums, part of the PostgreSQL category; --> Hi, Can anybody help me out to get following info of all the tables in a database. table_len tuple_count ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Performance

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 10:05 AM
Gauri Kanekar
 
Posts: n/a
Default Table Size

Hi,

Can anybody help me out to get following info of all the tables in a
database.

table_len
tuple_count
tuple_len
tuple_percent
dead_tuple_count
dead_tuple_len
dead_tuple_percent
free_space
free_percent

Thanks
Gauri

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 10:05 AM
Richard Huxton
 
Posts: n/a
Default Re: Table Size

Gauri Kanekar wrote:
> Hi,
>
> Can anybody help me out to get following info of all the tables in a
> database.


1. Have you read up on the information schema and system catalogues?
http://www.postgresql.org/docs/8.2/static/catalogs.html
http://www.postgresql.org/docs/8.2/static/catalogs.html


> table_len
> tuple_count
> tuple_len


2. Not sure what the difference is between "len" and "count" here.

> tuple_percent


3. Or what this "percent" refers to.

> dead_tuple_count
> dead_tuple_len
> dead_tuple_percent
> free_space
> free_percent


4. You might find some of the stats tables useful too:
http://www.postgresql.org/docs/8.2/s...ing-stats.html

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 10:06 AM
Guillaume Lelarge
 
Posts: n/a
Default Re: Table Size

Richard Huxton a écrit :
> Gauri Kanekar wrote:
>> Hi,
>>
>> Can anybody help me out to get following info of all the tables in a
>> database.

>
> 1. Have you read up on the information schema and system catalogues?
> http://www.postgresql.org/docs/8.2/static/catalogs.html
> http://www.postgresql.org/docs/8.2/static/catalogs.html
>
>
>> table_len
>> tuple_count
>> tuple_len

>
> 2. Not sure what the difference is between "len" and "count" here.
>


tuple_count is the number of live tuples. tuple_len is the length (in
bytes) for all live tuples.

>> tuple_percent

>
> 3. Or what this "percent" refers to.
>


tuple_percent is % of live tuple from all tuples in a table.

>> dead_tuple_count
>> dead_tuple_len
>> dead_tuple_percent
>> free_space
>> free_percent

>
> 4. You might find some of the stats tables useful too:
> http://www.postgresql.org/docs/8.2/s...ing-stats.html
>


Actually, these columns refer to the pgstattuple contrib module. This
contrib module must be installed on the server (how you install it
depends on your distro). Then, you have to create the functions on you
database :
psql -f /path/to/pgstattuple.sql your_database

Right after that, you can query these columns :

test=> \x
Expanded display is on.
test=> SELECT * FROM pgstattuple('pg_catalog.pg_proc');
-[ RECORD 1 ]------+-------
table_len | 458752
tuple_count | 1470
tuple_len | 438896
tuple_percent | 95.67
dead_tuple_count | 11
dead_tuple_len | 3157
dead_tuple_percent | 0.69
free_space | 8932
free_percent | 1.95

Example from README.pgstattuple.

Regards.


--
Guillaume.
<!-- http://abs.traduc.org/
http://lfs.traduc.org/
http://docs.postgresqlfr.org/ -->

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

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 04:59 AM.


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