From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Erik Aronesty" <erik(at)memebot(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Putting an INDEX on a boolean field? |
Date: | 2005-06-19 18:46:24 |
Message-ID: | 18815.1119206784@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
"Erik Aronesty" <erik(at)memebot(dot)com> writes:
> Should I start looking to figure out why the optimizer didn't figure out
> that it should be doing this sort of thing?
It looks to me that the problem is that convert_IN_to_join() is not
being smart about where to attach the IN's subselect to the join tree.
It's just adding it to the top FROM-expression, so that the join tree
is effectively
((sites left join quota) IN-join usersites)
and since we don't currently allow any rearrangement of outer joins,
this cannot be rearranged into
((sites IN-join usersites) left join quota)
as you'd like.
The really clean solution to this would be to implement logic about when
it is safe to rearrange the join order of outer joins. But I think
that's a fairly hard problem in general. A shorter-term solution might
be possible by teaching convert_IN_to_join() to attach the IN subselect
further down in the join tree, using logic similar to what we use to
decide where ordinary WHERE quals can bubble down to.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | mohammad izwan ibrahim | 2005-06-20 03:11:23 | accessing database without a persistent connection |
Previous Message | Michael Fuhr | 2005-06-19 16:22:09 | Re: WHY transaction waits for another transaction? |