On 24 Aug 2009, at 3:44am, Tito Ciuro wrote:

> Is there a way to optimize this type of queries? (column Value is
> indexed):
>
> SELECT Value FROM MyValues WHERE Value LIKE '%crashed.'
>
> I've seen the document where 'begins with' queries can be optimized
> using >= and < (end of the '4.0 The LIKE optimization' section):
>
> http://www.sqlite.org/optoverview.html
>
> Can I optimize this query to take advantage of the index?

Sure.  When you use INSERT either define two columns (value and  
valueReversed) or just store valueReversed.  Then use LIKE with  
valueReversed instead of value.  There is no 'reverse string' function  
built into SQLite, but I bet whichever programming language you're  
using makes it easy to reverse a string.

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

Reply via email to