Any particular reason you can't build your own string and just pass one parameter?
select * from words where "word" like ?; And any reason why you don't create a 2nd field holds the 1st and last char? and index that? Then your query should be blazingly fast as it will actually use the index (which I don't believe LIKE uses at all). Though it is curious as to why the speed difference...does sqlite build the like string on every compare or such? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate ________________________________ From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Baruch Burstein [bmburst...@gmail.com] Sent: Sunday, July 10, 2011 7:27 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] using index when using concatination I am using the following SQL statement for SQLite: select * from words where "word" like ? || '%' || ? ; In order to bind parameters to the first and last letters. I have tested this both with and without an index on the column `word`, and the results are the same. However, when running the queries as select * from words where "word" like 'a%a'; etc. (that is, hardcoding each value instead of using ||, the query is about x10 faster when indexed. Can someone show me how to use both the index and the parameters? _______________________________________________ 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