Yeah, you don't just need an index on all columns. You need the right indexes with the right combination of columns.
Also, use prepared statements. If you don't use prepared statements SQLite will have to recompile those queries at every execution, which can take some time. John -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Tuesday, October 27, 2009 6:56 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Slow SELECTs in application On 27 Oct 2009, at 8:30am, Unabashed wrote: > I have two general types of selects for this table. First one is > "SELECT > word,wform,id_norm FROM mgWords WHERE id=<some_value>" > and second is > "SELECT > id FROM mgWords WHERE (word='<some_val1>') AND (wform='<some_val2>') > AND > (id_norm=<some_val3>)". > So I tried to add indexes to all fileds in my table: > CREATE INDEX id_norm ON mgWords (id_norm) > CREATE INDEX word ON mgWords (word) > CREATE INDEX wform ON mgWords (wform) Someone needs to explain to people what SQL indexes are for. For your first SELECT, CREATE INDEX id ON mgWords (id) For your second SELECT CREATE INDEX id ON mgWords (word,wform,id_norm,id) Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users