Re: [GENERAL] full outer join performance

2005-09-13 Thread Ben
Tom Lane wrote: I think the problem was that he had select ... from a, b full join c on ... where ... where table b is big and you only need a few rows from it, so it really needs to be joined last, but the above forced doing it first. It wasn't clear to me why he wanted the full join

Re: [GENERAL] full outer join performance

2005-09-13 Thread Ben
I see. I think I'm going to restructure my logic so I won't have to use the outer join after all, but thanks for the pointers anyway. Tom Lane wrote: Ben <[EMAIL PROTECTED]> writes: Hrm, as I understand that page, there's not much that can be done about the join order for outer joins. At l

Re: [GENERAL] full outer join performance

2005-09-13 Thread Scott Marlowe
On Tue, 2005-09-13 at 13:28, Ben wrote: > Hrm, as I understand that page, there's not much that can be done about > the join order for outer joins. At least, not when there's on 3 tables > and 1 outer join involved. Am I missing something? You might be able to do some kind of thing like: select

Re: [GENERAL] full outer join performance

2005-09-13 Thread Tom Lane
Scott Marlowe <[EMAIL PROTECTED]> writes: > Tom, would that help the planner make better choices for this kind of > query? I think the problem was that he had select ... from a, b full join c on ... where ... where table b is big and you only need a few rows from it, so it really needs t

Re: [GENERAL] full outer join performance

2005-09-13 Thread Tom Lane
Ben <[EMAIL PROTECTED]> writes: > Hrm, as I understand that page, there's not much that can be done about > the join order for outer joins. At least, not when there's on 3 tables > and 1 outer join involved. Am I missing something? Without knowing what you want the query to do, it's difficult to

Re: [GENERAL] full outer join performance

2005-09-13 Thread Ben
Hrm, as I understand that page, there's not much that can be done about the join order for outer joins. At least, not when there's on 3 tables and 1 outer join involved. Am I missing something? Tom Lane wrote: Ben <[EMAIL PROTECTED]> writes: Are full outer joins expected to perform much wo

Re: [GENERAL] full outer join performance

2005-09-13 Thread Tom Lane
Ben <[EMAIL PROTECTED]> writes: > Are full outer joins expected to perform much worse than inner joins? You're getting burnt by the outer join forcing a bad join order. There's some related discussion here: http://www.postgresql.org/docs/8.0/static/explicit-joins.html reg

[GENERAL] full outer join performance

2005-09-13 Thread Ben
Are full outer joins expected to perform much worse than inner joins? I'm seeing 2 orders of magnitude difference for an almost identical query. (Well, as "identical" as you can get, comparing a query with an outer join to one without.) This is on 8.0.3, recently analyzed. Here are the explain