Matt <msubs@philips.org.uk> writes:
> Yesterday I added 20 more join statements to the query (identical to
> existing statements) and now the main query which would run in <30
> seconds, runs indefinitely with the process stuck at "PARSE" in version
> 7.4, or "BIND" in version 8.0.3.
You *really* need to rethink your database design :-( ... thirty-way
JOINs are just not a very good idea.
Having said that, though, the fact that they're all outer joins should
save you from an exponential blowup in planning time, because there's
only one legal join order. I'm not sure where the time is going.
If you'd be willing to send me a test case off-list, I'd be willing to
take a look. A convenient test case from my point of view would be a
SQL script that sets up the database plus another one containing the
slow query.
regards, tom lane