Re: Big problems with query optimization - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Big problems with query optimization
Date
Msg-id 28510.989165381@sss.pgh.pa.us
Whole thread Raw
In response to Big problems with query optimization  (pgsql-bugs@postgresql.org)
List pgsql-bugs
pgsql-bugs@postgresql.org writes:
> Release 7.0
> faqts=> explain select faqs.id from faqs, faq_keywords;
> NOTICE:  QUERY PLAN:
> Nested Loop  (cost=0.00..4908.80 rows=161320 width=8)
>   ->  Seq Scan on faqs  (cost=0.00..2.40 rows=40 width=4)
>   ->  Seq Scan on faq_keywords  (cost=0.00..82.33 rows=4033 width=4)
> EXPLAIN

> Compare with release 6.5 reaction:
> faqtat=> explain select faqs.id from faqs, faq_keywords;
> NOTICE:  QUERY PLAN:
> Seq Scan on faqs  (cost=43.00 rows=1000 width=4)
> EXPLAIN

7.0 is correct.  6.5 is broken.  Read the SQL standard: "select a.f from
a" is not the same query as "select a.f from a,b".  The latter should
return each a.f value as many times as there are rows in b.

            regards, tom lane

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Big problems with query optimization
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: The ignored "_" character