Re: Maximum number of columns in a table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Maximum number of columns in a table
Дата
Msg-id 10205.1239492360@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Maximum number of columns in a table  (Sam Mason <sam@samason.me.uk>)
Список pgsql-general
Sam Mason <sam@samason.me.uk> writes:
> Just out of interest; what would happen if you had:

>   CREATE TABLE wider (
>     col0001 TEXT,
>     col0002 TEXT,
>     -- [ .... ]
>     col9998 TEXT,
>     col9999 TEXT
>   );

>   CREATE TABLE store (
>     pk1 INTEGER,
>     pk2 TEXT,
>       PRIMARY KEY (pk1,pk2),
>     data wider
>   );

> Would the "data" tend to end up toasted, or would PG try and expand the
> data inline and fail some of the time?

The toast code doesn't recurse into composite values.  It would see the
"data" column as one single value, so most of the time data would get
toasted and pushed out as a unit.  You probably don't want to adopt the
above design.  (Also, you'd still be subject to the 1600 column limit
on the number of fields within "data", because that comes from a tuple
header field width limit that has nothing to do with total tuple size.)

> Also, if I ran the following query:

>   SELECT pk1, pk2, (data).col0001, (data).col0101 FROM store;

> Would "data" get detoasted once per row, or per column referenced?

Probably the latter.  I did some work a few months ago trying to make
the former happen, but it crashed and burned for reasons I don't recall
at the moment.

            regards, tom lane

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

Предыдущее
От: Sam Mason
Дата:
Сообщение: Re: Maximum number of columns in a table
Следующее
От: "Gerry Scales"
Дата:
Сообщение: Re: Maximum number of columns in a table