| From: | Helge Bahmann <bahmann(at)math(dot)tu-freiberg(dot)de> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: Need help - optimizer trouble |
| Date: | 2001-04-05 11:41:39 |
| Message-ID: | Pine.LNX.4.21.0104051330550.21299-100000@lothlorien.stunet2.tu-freiberg.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
On Wed, 4 Apr 2001, Tom Lane wrote:
> 7.1 treats the JOIN clauses as determining join order, where 7.0 did
> not. Looks like you should re-order the query to be, say,
>
> SELECT doc FROM written_by AS wb
> JOIN author_keyword AS kw ON kw.author_id=wb.author_id
> JOIN document ON document.doc_id=wb.doc_id
> WHERE kw.keyword='foo'
It works! I restructured my query
SELECT doc FROM document
JOIN (SELECT keyword, doc_id FROM written_by AS _w
JOIN author_keyword AS _kw ON _w.author_id=_kw.author_id
) AS wb ON document.doc_id=wb.doc_id
WHERE wb.keyword='foo'
which is easier to handle for my application logic and it is pretty fast
now.
Many thanks for your help!
regards,
Helge
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Harald Barrera Dubois | 2001-04-05 11:45:40 | Floating point division. |
| Previous Message | Andrew McMillan | 2001-04-05 09:55:05 | Re: Max Tuple Size |