pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_class.relpages
4+ messages / 3 participants
[nested] [flat]
* pg_class.relpages
@ 2003-09-28 00:17 Bertrand Petit <pgsql-sql@phoe.frmug.org>
0 siblings, 2 replies; 4+ messages in thread
From: Bertrand Petit @ 2003-09-28 00:17 UTC (permalink / raw)
To: pgsql-sql
Does the figures stored in pg_class.relpages include the pages
consumed by the toast tables linked to a normal table?
--
%!PS
297.6 420.9 translate 90 rotate 0 setgray gsave 0 1 1{pop 0 180 moveto 100
180 170 100 170 -10 curveto 180 -9 180 -9 190 -10 curveto 190 100 100 180
0 180 curveto fill 180 rotate}for grestore/Bookman-LightItalic findfont
240 scalefont setfont -151.536392 -63.7998886 moveto (bp)show showpage
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pg_class.relpages
@ 2003-09-28 00:26 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Bertrand Petit <pgsql-sql@phoe.frmug.org>
1 sibling, 1 reply; 4+ messages in thread
From: Bruce Momjian @ 2003-09-28 00:26 UTC (permalink / raw)
To: Bertrand Petit <pgsql-sql@phoe.frmug.org>; +Cc: pgsql-sql
Bertrand Petit wrote:
>
> Does the figures stored in pg_class.relpages include the pages
> consumed by the toast tables linked to a normal table?
No. See the chapter on monitoring disk space for more information.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pg_class.relpages
@ 2003-09-28 00:31 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bertrand Petit <pgsql-sql@phoe.frmug.org>
1 sibling, 0 replies; 4+ messages in thread
From: Tom Lane @ 2003-09-28 00:31 UTC (permalink / raw)
To: Bertrand Petit <pgsql-sql@phoe.frmug.org>; +Cc: pgsql-sql
Bertrand Petit <pgsql-sql@phoe.frmug.org> writes:
> Does the figures stored in pg_class.relpages include the pages
> consumed by the toast tables linked to a normal table?
No. The toast tables have their own pg_class.relpages entries ...
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pg_class.relpages
@ 2003-09-28 01:53 Bertrand Petit <pgsql-sql@phoe.frmug.org>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Bertrand Petit @ 2003-09-28 01:53 UTC (permalink / raw)
To: pgsql-sql
On Sat, Sep 27, 2003 at 08:26:16PM -0400, Bruce Momjian wrote:
> Bertrand Petit wrote:
> >
> > Does the figures stored in pg_class.relpages include the pages
> > consumed by the toast tables linked to a normal table?
>
> No. See the chapter on monitoring disk space for more information.
Okay. I eventually wrote the following query that lists tables
and indices sizes. A view similar to this query might my useful for
the general public if defined in the information schema.
SELECT pg_namespace.nspname AS schema,
COALESCE((SELECT class3.relname
FROM pg_class AS class3, pg_index
WHERE class1.oid=pg_index.indexrelid AND
class3.oid=pg_index.indrelid),
class1.relname) AS table,
CASE
WHEN class1.relkind='r' THEN NULL
ELSE class1.relname
END AS index,
(SELECT COALESCE(class1.relpages+SUM(class2.relpages),
class1.relpages) * 8
FROM pg_class AS class2
WHERE class2.oid IN (class1.reltoastrelid,
class1.reltoastidxid)) AS size
FROM pg_class AS class1, pg_namespace
WHERE class1.relnamespace = pg_namespace.oid AND
pg_namespace.nspname NOT IN ('pg_catalog',
'information_schema',
'pg_toast') AND
class1.relkind IN ('r', 'i')
ORDER BY class1.relnamespace ASC, class1.relname ASC,
class1.relkind DESC
--
%!PS
297.6 420.9 translate 90 rotate 0 setgray gsave 0 1 1{pop 0 180 moveto 100
180 170 100 170 -10 curveto 180 -9 180 -9 190 -10 curveto 190 100 100 180
0 180 curveto fill 180 rotate}for grestore/Bookman-LightItalic findfont
240 scalefont setfont -151.536392 -63.7998886 moveto (bp)show showpage
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2003-09-28 01:53 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-28 00:17 pg_class.relpages Bertrand Petit <pgsql-sql@phoe.frmug.org>
2003-09-28 00:26 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-09-28 01:53 ` Bertrand Petit <pgsql-sql@phoe.frmug.org>
2003-09-28 00:31 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox