Re: Convenient dump of table and object size in PG 7.4

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Convenient dump of table and object size in PG 7.4
Дата
Msg-id 20050527024812.GB18417@surnet.cl
обсуждение исходный текст
Ответ на Convenient dump of table and object size in PG 7.4  (Steve Lane <slane@soliantconsulting.com>)
Ответы Re: Convenient dump of table and object size in PG 7.4  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Convenient dump of table and object size in PG 7.4  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
On Thu, May 26, 2005 at 09:39:26PM -0500, Steve Lane wrote:

> Attached is a view I wrote for postgres 7.4 that seems to provide pretty
> accurate reporting of table sizes. For each non-system table in a database
> it shows base table size, size of any related TOAST data, and aggregate size
> of indexes.
>
> The code is somewhat ugly in that it contains a bunch of CASE statements the
> sole point of which is to transform the occasional NULL into a 0.
>
> Object sizes are computed from pg_class.relpages with an assumed page size
> of 8192.
>
> Comments and improvements most welcome.

You could change all those "CASE WHEN foo IS NULL THEN 0 ELSE foo" into
COALESCE(foo, 0).

Additionally, "show block_size" will give you the block (page) size.  I
don't see how would you use that in a query though.

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"La tristeza es un muro entre dos jardines" (Khalil Gibran)

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

Предыдущее
От: Steve Lane
Дата:
Сообщение: Convenient dump of table and object size in PG 7.4
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Convenient dump of table and object size in PG 7.4