Re: About Maximum number of columns

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: zhaoxin <zhaox(at)necas(dot)nec(dot)com(dot)cn>, pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: About Maximum number of columns
Date: 2005-12-22 16:14:37
Message-ID: 1135268077.18741.42.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2005-12-22 at 10:10, Jim C. Nasby wrote:
> On Thu, Dec 22, 2005 at 07:22:12PM +0800, zhaoxin wrote:
> > Hi All.
> >
> > I have a question about the Maximum number of columns in a table ?
> >
> > In FAQ for PostgreSQL,I can find this description :
> > Maximum number of columns in a table?
> > 250-1600 depending on column types
> > But , I want to know what type is 1600 limit , and what type is 250
> > limit . it is important for me , thanks .
>
> I'm pretty sure I've read the reason for the limit somewhere in the
> source code, but I can't remember where. It's probably somewhere in
> http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/. I know
> that the exact upper limit isn't actually 1600 fields, it's more like
> 1643 or something.
>
> But, as others have said, just try creating your table and see what
> happens. If it fails, you might be able to get it to work by increasing
> the block size.
>
> And as others have said, this is almost certainly a horrible schema that
> needs to be fixed, badly. Luckily, thanks to views and rules, you could
> probably fix it without actually changing any of the client code.

The limit has to do with the fact that all the "header" info for each
column must fit in a single block (8K default).

I seem to recall someone stating that increasing block size to 16k or
32k could increase this number by about 2x or 4x. Not sure if it'll
work, but it might be worth the effort if you're stuck keeping some
legacy app happy long enough to replace it with a well designed system.

Oh to be able to travel back in time and smack people for designing 1600
column tables... :)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2005-12-22 16:16:16 Re: Is CREATE TYPE an alias for CREATE DOMAIN?
Previous Message Bruce Momjian 2005-12-22 16:13:30 Re: Is CREATE TYPE an alias for CREATE DOMAIN?