relpages for pg_toast.* tables

From: Paul Ramsey <pramsey(at)cleverelephant(dot)ca>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: relpages for pg_toast.* tables
Date: 2015-08-28 13:16:05
Message-ID: CACowWR0S7-G_XQEJ-n9OJbaQ0UgYsELq=xPYjy3pL4zAdMGUSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've been trying to write up a "pg_total_relation_size()" replacement
that just uses the system tables (sum up relpages for tables, indexes
and toast tables), thereby avoiding the overhead of running stat() on
thousands of filesystem tables, but I've come up against what seems to
be an unsuperable problem.

The `relpages` data for the toast tables doesn't seem to get updated.
Not when I run a general 'ANALYZE' call, and when I specifically call
ANALYZE on the toast tables, it tells me "WARNING: skipping
"pg_toast_4597532" --- cannot analyze non-tables or special system
tables". Well, OK then.

Presumably this is by design, but it makes it impossible to get a true
guesstimate (as of latest ANALYZE) of size. Are there any known
workarounds?

Thanks,
P

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Ramsey 2015-08-28 13:29:11 Re: relpages for pg_toast.* tables
Previous Message Igor Neyman 2015-08-28 13:04:32 Re: UPDATE an updatable view