Re: control to don't toast one new type

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Mohsen SM <mohsensoodkhah(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: control to don't toast one new type
Date: 2013-12-30 01:21:11
Message-ID: 52C0CA87.5030002@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/28/2013 06:28 PM, Mohsen SM wrote:
> I create type based on varlena.
> I want control it that don't toast.

In general it's probably going to be better to just specify the storage
option on a column by column basis:

ALTER TABLE ... ALTER COLUMN ... SET STORAGE PLAIN;

A quick look at the sources suggests that as far as Pg is concerned, if
it's varlena it's potentially TOASTable. Take a look at
needs_toast_table - you'l see there that for each table attribute, it
treats the attribute as toastable if it's (a) not fixed length and (b)
not 'p' (PLAIN) storage.

So, while I'm far from an expert, my impression is that you'd need to
force 'attstorage' to 'p' wherever your type appears. You do that with
pg_type.typstorage . See
http://www.postgresql.org/docs/9.3/static/catalog-pg-type.html,
'typstorage'.

Your question's pretty unclear, so I'm not really sure you just want to
prevent TOASTing, or why you want to. If this isn't really what you
wanted to do, please explain the *why* behind your question. Why do you
want to do this? What problem are you trying to solve? What do you think
it will achieve?

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2013-12-30 03:02:07 Re: [bug fix] multibyte messages are displayed incorrectly on the client
Previous Message Craig Ringer 2013-12-30 01:02:13 Re: Custom collations, collation modifiers (eg case-insensitive)