Suppose I have a table Foo with two columns: state, company_stock_symbol. 
(There are other columns but let's ignore them.)

The states are relatively few (50). There are tens of thousands of companies.

* If I frequently do queries like this:
"SELECT * FROM Foo WHERE company_stock_symbol='bar' AND state='baz';"
what index should I use?
Should I use (company_stock_symbol), (state,company_stock_symbol), or 
(company_stock_symbol,state)?

* Does the answer change if the query condition is reversed? Like so:
"SELECT * FROM Foo WHERE state='baz' AND company_stock_symbol='bar';"           
                          
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to