From: Stephen Frost <sfrost@snowman.net>
To: Andreas Joseph Krogh <andreas@visena.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Sv: Re: Sv: Re: Does PostgreSQL check database integrity at startup?
Date: Sat, 30 Dec 2017 20:03:15 -0500
Message-ID: <20171231010315.GN2416@tamriel.snowman.net> (raw)
In-Reply-To: <VisenaEmail.0.3ba989d7b40a2db4.160a9f3d3f2@tc7-visena>
References: <20171230234931.GM2416@tamriel.snowman.net>
<VisenaEmail.0.3ba989d7b40a2db4.160a9f3d3f2@tc7-visena>
Greetings Andreas,
* Andreas Joseph Krogh (andreas@visena.com) wrote:
> Here's a simple test-case:
>
> createdb test
> test=# create table foo(id serial primary key, name varchar not null);
> test=# CREATE TYPE BigIntTuple2 AS (f1 bigint, f2 bigint);
Hah, appears we allocate a relfilenode to types too, though it's not
entirely clear to me why (evidently, they're not used..).
Anyhow, adding a filter on relkind addresses it (though it's not very
future-proof, unfortunately):
SELECT
quote_ident(nsp.nspname) || '.' || quote_ident(c.relname),
s.setting || '/base/' || db.oid || '/' || c.relfilenode,
(pg_stat_file(s.setting || '/base/' || db.oid || '/' || c.relfilenode)).size as size
FROM
pg_settings s
JOIN pg_database db on (s.name = 'data_directory')
JOIN pg_class c on (datname = current_database())
JOIN pg_namespace nsp on (c.relnamespace = nsp.oid)
WHERE
relfilenode <> 0
AND nsp.nspname !~ '^pg_'
AND nsp.nspname <> 'information_schema'
AND c.relkind in ('r','i','m','p');
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: sfrost@snowman.net, andreas@visena.com
Subject: Re: Does PostgreSQL check database integrity at startup?
In-Reply-To: <20171231010315.GN2416@tamriel.snowman.net>
References: <20171230234931.GM2416@tamriel.snowman.net> <VisenaEmail.0.3ba989d7b40a2db4.160a9f3d3f2@tc7-visena> <20171231010315.GN2416@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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