Re: missing toast table for pg_policy - Mailing list pgsql-hackers

From Joe Conway
Subject Re: missing toast table for pg_policy
Date
Msg-id 0b9ae12d-033d-bc3a-0a55-03c3bd2c68da@joeconway.com
Whole thread Raw
In response to Re: missing toast table for pg_policy  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: missing toast table for pg_policy
Re: missing toast table for pg_policy
List pgsql-hackers
On 02/17/2018 11:39 AM, Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>> Yes, exactly. I'm fine with not backpatching, just wanted to raise the
>> possibility. I will push later today to HEAD (with a catalog version bump).
>
> BTW, I was wondering if it'd be a good idea to try to forestall future
> oversights of this sort by adding a test query in, say, misc_sanity.sql.
> Something like
>
> select relname, attname, atttypid::regtype
> from pg_class c join pg_attribute a on c.oid = attrelid
> where c.oid < 16384 and reltoastrelid=0 and relkind = 'r' and attstorage != 'p'
> order by 1,2;
>
> If you try that you'll see the list is quite long:

<snip>

> I think in most of these cases we've consciously decided not to toast-ify,
> but maybe some of them need a second look.

Is there really a compelling reason to not just create toast tables for
all system catalogs as in the attached? Then we could just check for 0
rows in misc_sanity.sql.

For what its worth:
--------------------
HEAD
--------------------
# du -h --max-depth=1 $PGDATA
[...]
22M     /usr/local/pgsql-head/data/base
[...]
584K    /usr/local/pgsql-head/data/global
[...]
38M     /usr/local/pgsql-head/data

time make check
real    0m16.295s
user    0m3.597s
sys     0m1.465s

--------------------
with patch
--------------------
# du -h --max-depth=1 $PGDATA
[...]
23M     /usr/local/pgsql-head/data/base
[...]
632K    /usr/local/pgsql-head/data/global
[...]
39M     /usr/local/pgsql-head/data

time make check
real    0m16.462s
user    0m3.521s
sys     0m1.531s

select relname, attname, atttypid::regtype
from pg_class c join pg_attribute a on c.oid = attrelid
where c.oid < 16384 and reltoastrelid=0 and relkind = 'r' and attstorage
!= 'p'
order by 1,2;
 relname | attname | atttypid
---------+---------+----------
(0 rows)


--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachment

pgsql-hackers by date:

Previous
From: Michail Nikolaev
Date:
Subject: Re: [HACKERS] Can ICU be used for a database's default sort order?
Next
From: Tom Lane
Date:
Subject: Re: missing toast table for pg_policy