Hi Simon,

But that would introduce the overhead of doubling the space required  
for every string + an additional column index. If the schema contains  
more columns where this type of query needs to take place, it seems to  
me that this would not be a good solution.

Thanks for your help,

-- Tito

On Aug 23, 2009, at 8:15 PM, Simon Slavin wrote:

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

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

Reply via email to