In the process of converting database from sql express to sqlite, I have the
following query that runs very slow on sqlite compared to sql server:

SELECT distinct Table1.Column1, Table2.Column2,  Table1.Column2
FROM ( Table1 INNER JOIN Table2 ON Table1.Column1 = Table2.Column1)
WHERE ( Table1.PrimaryKeyID =?) And ( Table1.Column1 IS NOT NULL)

The explain query plan looks like,

0 0 0 SEARCH TABLE Table1 USING AUTOMATIC COVERING INDEX (PrimaryKeyID=?)
(~7 rows)
0 1 1 SEARCH TABLE Table2 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)
0 0 0 USE TEMP B-TREE FOR DISTINCT

without the distinct this query runs very fast.  would adding an index on
all columns used in the select will speed this query?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to