Re: EXPLAIN SELECT .. does not return - Mailing list pgsql-general

From Tom Lane
Subject Re: EXPLAIN SELECT .. does not return
Date
Msg-id 9146.1143688246@sss.pgh.pa.us
Whole thread Raw
In response to EXPLAIN SELECT .. does not return  (David Link <dlink@soundscan.com>)
Responses Re: EXPLAIN SELECT .. does not return  (David Link <dlink@soundscan.com>)
List pgsql-general
David Link <dlink@soundscan.com> writes:
> The following large EXPLAIN SELECT Statement fails to return, but
> continues to take up processing time until it is killed.
> [ 52-way join... ]

Am I right in guessing that all the sales_xxx tables are the same size
and have similar statistics?  I think the problem is that the planner is
faced with a large set of essentially equivalent plans and isn't pruning
the list aggressively enough.  That's something we fixed in 8.0.

> Postgresql 7.4.8

You really oughta try something newer.  On my machine, 7.4.12 plans a
52-way join in about a minute, and 8.0 and 8.1 in under a second.

I wonder also if there's not a better way to design the query...
maybe a UNION ALL would work better than nested joins.

            regards, tom lane

pgsql-general by date:

Previous
From: Reid Thompson
Date:
Subject: Re: Implementation Suggestions
Next
From: Achilleus Mantzios
Date:
Subject: Re: [SQL] Flight numbers data