Search Postgresql Archives

Re: Maximum number of columns in a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sam Mason <sam@xxxxxxxxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux