--- Tom Allison <tom@tacocat.net> wrote:
> This is getting really ugly...
> it won't finish in less than .. minutes.
>
> spam=> explain select u2.token_idx, t.token_idx, foo.token from
> tokens t left outer join user_token u1 using (token_idx),
> users u left outer join user_token u2 using (user_idx),
> (values('one'),('want'),('examine'),('three')) as foo(token)
> left outer join tokens using (token)
> where u.user_idx = 15;
It looks to me that your query has (3) left joins and (3) implied cross-joins. Perhaps reforming
your query to eliminate the cross-joins with help performance. In regard to your tables <tokens>
and <user_tokens>, in this query you are referring to (2) separate instances of these tables when
a single instance these tables would probably work just fine. i.e.
tokens t vs. tokens,
user_token u1 vs user_token u2
Regards,
Richard Broersma Jr.