Re: Quickly calculating row size of a table?

Поиск
Список
Период
Сортировка
От Jared Evans
Тема Re: Quickly calculating row size of a table?
Дата
Msg-id 1130253051.560395.41580@g44g2000cwa.googlegroups.com
обсуждение исходный текст
Ответ на Re: Quickly calculating row size of a table?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Quickly calculating row size of a table?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Zlatko Matić
Дата:
Сообщение: querying PostgreSQL version?
Следующее
От: Janning Vygen
Дата:
Сообщение: Re: the best way to catch table modification