On Fri, 15 Nov 2013 12:55:07 +0000
"L. Wood" <lwoo...@live.com> wrote:

> 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)?

The first column in an index should be the one that appears most often
in WHERE or GROUP BY clauses.  That lets SQLite use the index to find
the rows you usually want.  

HTH.  

--jkl

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to