On Sun, Oct 18, 2009 at 02:17:42PM +0200, Kristoffer Danielsson scratched on the wall:
> Blistering fast: > SELECT COUNT(*) FROM Item; > Result: 10000 > > Slooooow! WRONG result: > SELECT COUNT(*) FROM Item NATURAL JOIN Item; > Result: 100000000 > > Clearly, SQLite executes a cartesian product! Look at the output. It does not produce a Cartesian product. All the rows are valid: SQLite version 3.6.19 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table t (c1, c2); sqlite> insert into t values ( 1, 2 ); sqlite> insert into t values ( 3, 4 ); sqlite> insert into t values ( 5, 6 ); sqlite> select * from t natural join t; 1|2 1|2 1|2 3|4 3|4 3|4 5|6 5|6 5|6 I'm not sure I'd call it correct, but it isn't a product. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Our opponent is an alien starship packed with atomic bombs. We have a protractor." "I'll go home and see if I can scrounge up a ruler and a piece of string." --from Anathem by Neal Stephenson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users