> dcc=# EXPLAIN ANALYZE select * from documents left outer join comments on 
> (documents.doc_num = comments.doc_num) where documents.doc_num in (select 
> doc_num from documents limit 10);

This query is preforming the join on all records of your two tables.  After all 
of the that
exhaustive work is done, it this filter out the records you want.  you should 
preform a filtered
select first and then use those results in you left join.  I guess the lesson 
you can learn from
this example is that you should try to filter your data set to get it as small 
as possible before
you do anything else with it.

select
        *

from
        (
         select doc_num from documents limit 10
        ) as D1
left outer join
        comments
on
        (D1.doc_num = comments.doc_num)
;

Regards,

Richard Broersma Jr.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to