Re: JOIN column maximum - Mailing list pgsql-general

From Tom Lane
Subject Re: JOIN column maximum
Date
Msg-id 22933.1325805493@sss.pgh.pa.us
Whole thread Raw
In response to JOIN column maximum  (Lee Hachadoorian <lee.hachadoorian@gmail.com>)
Responses Re: JOIN column maximum  (Lee Hachadoorian <lee.hachadoorian@gmail.com>)
List pgsql-general
Lee Hachadoorian <lee.hachadoorian@gmail.com> writes:
> How is the number of columns in a join determined? When I combine somewhere
> around 90 tables in a JOIN, the query returns:

> ERROR: joins can have at most 32767 columns

It's the sum of the number of columns in the base tables.

> I'm sure most people will say "Why the hell are you joining 90 tables."

Not only that, but why are you working with over-300-column tables?
Seems like your schema design needs rethinking.

> I've asked this list before for advice on how to work with the
> approximately 23,000 column American Community Survey dataset,

Are there really 23000 populated values in each row?  I hesitate to
suggest an EAV approach, but it kinda seems like you need to go in that
direction.  You're never going to get decent performance out of a schema
that requires 100-way joins, even if you avoid bumping up against hard
limits.

            regards, tom lane

pgsql-general by date:

Previous
From: Lee Hachadoorian
Date:
Subject: JOIN column maximum
Next
From: Lee Hachadoorian
Date:
Subject: Re: JOIN column maximum