Re: control to don't toast one new type

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: control to don't toast one new type
Дата
Msg-id 52C0CA87.5030002@2ndquadrant.com
обсуждение исходный текст
Ответ на control to don't toast one new type  (Mohsen SM <mohsensoodkhah@gmail.com>)
Список 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





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Custom collations, collation modifiers (eg case-insensitive)
Следующее
От: Noah Misch
Дата:
Сообщение: Re: [bug fix] multibyte messages are displayed incorrectly on the client