From: | "Jared Evans" <jnevans(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Quickly calculating row size of a table? |
Date: | 2005-10-25 15:10:51 |
Message-ID: | 1130253051.560395.41580@g44g2000cwa.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks very much for both your posts.
I tried both:
First, I performed a full vacuum on the entire database then
dbn=# SELECT relname, relpages*8192/reltuples from pg_class where
reltuples <> 0 and relname not like 'pg%';
atablename | 2047.95
The first SQL statement gave me a rough idea of the tuple size while
the second SQL statement seemed to give out more details about the
table and its tuples.
dbn=# select 'atablename' as table_name, * from
pgstattuple('"public"."atablename"');
-[ RECORD 1 ]------+----------
table_name | atablename
table_len | 160137216
tuple_count | 78194
tuple_len | 129868251
tuple_percent | 81.1
dead_tuple_count | 0
dead_tuple_len | 0
dead_tuple_percent | 0
free_space | 29419740
free_percent | 18.37
129868251 / 78194 = 1660.85
There's still a difference between the two reported tuple size of
atablename: 2047.95 - 1660.85 = 387.10
Can someone shed some more light on this and which one more closely
approximates the size of the tuples?
Jared
From | Date | Subject | |
---|---|---|---|
Next Message | Csaba Nagy | 2005-10-25 15:24:58 | Re: Deleting vs foreign keys |
Previous Message | Michael Fuhr | 2005-10-25 15:09:44 | Re: Select all invalid e-mail addresses |