failed to build any 5-way joins

From: "Alessandro Depase" <alessandro(dot)depase(at)libero(dot)it>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: failed to build any 5-way joins
Date: 2003-12-16 11:46:49
Message-ID: 001e01c3c3ca$4c0c4af0$0200a8c0@dedalus1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,
I got the error message reported in the subject and I could not find anything about it anywhere.
I cannot get any explain plan for this query.

I'm working on PosgreSQL 7.4-1, the latest cygwin distribution I can find.

The query generating the error is:

select *
from info where parent_infoid is null
and fieldtypeid in (select fieldtypeid from users_auth_groups uag1, field_auth fa where userid = 8 and fa.groupid = uag1.groupid)
and main_infoid in (select ic.infoid from info_category ic, category_auth ca, users_auth_groups uag2
where ic.categoryid = ca.categoryid and uag2.userid = 8 and uag2.groupid = ca.groupid and read_write = 'W')

I already have a workaround, but I don't like it because it seems to me that it could be a little slower (executing the exists clause for every possible record got from the rest of the query, according to the explain plan results - and if I understood them well :) ):

select *
from info where parent_infoid is null
and exists (select * from users_auth_groups uag1, field_auth fa where userid = 8 and fa.groupid = uag1.groupid and info.fieldtypeid = fa.fieldtypeid)
and main_infoid in (select ic.infoid from info_category ic, category_auth ca, users_auth_groups uag2
where ic.categoryid = ca.categoryid and uag2.userid = 8 and uag2.groupid = ca.groupid and read_write = 'W')

This seems to work, however (and I will keep it until I will find another solution - well, I know that, for example, I can do it using stored procedure, splitting the query in more steps, but this is not my first choice, at the moment, for reasons too long to explain here).

The problem is: does anyone know what sort of error did I get and/or where can I find docs about it?
I suppose (just from the error message) that the optimizer is trying to translate the first query in a join and it gets an error doing so. But, is this error related to some limits in PostgreSQL? Are there limits in joining tables? I could not find anything about this too (I just found a my-sql crash-me test report in which they tell that PostgreSQL - v. 7.1.1 - passed the test with 64+ tables).

Thanks to you all for you help

Bye
Alessandro Depase

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2003-12-16 13:28:07 Re: dump and schema
Previous Message Olivier Hubaut 2003-12-16 09:27:54 Re: dump and schema