Hey Ray,
I'm by no means a guru but here is my simple analysis. In the first
query, the 10 "documents" specified 'IN' the in are first selected from
the "documents" table. Then, those 10 rows are joined with the
"comments" table.
In the second query, every row in the "documents" table is j
I've been foolin with this for a couple of days
Sometimes you just have to ask
Thanks gentlemen
On Tue, 5 Dec 2006, Tom Lane wrote:
Richard Ray <[EMAIL PROTECTED]> writes:
dcc=# EXPLAIN ANALYZE select * from documents left outer join comments on
(documents.doc_num = comments.doc_num) where doc
> 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
Richard Ray <[EMAIL PROTECTED]> writes:
> 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);
> [ is slow ]
This isn't your fault, it's an optimizer limitation: P
Allow me to demonstrate my pitiful SQL knowledge
I have tables documents and comments
If I run join and list doc_nums the query is quite fast
If I run join and use subselect the query is extremely slow
Can someone offer analysis
Thanks
Richard
dcc=# EXPLAIN ANALYZE select doc_num from documents