Hi Simon,

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

>
> On 24 Aug 2009, at 4:22am, Tito Ciuro wrote:
>
>> But that would introduce the overhead of doubling the space required
>> for every string + an additional column index.
>
> One of the options I mentioned was to store the reversed string and
> not the original.  If you need to reconstruct the original string,
> read the reversed one and reverse it your software.
>
> Will you actually be short on space ?  If you're programming for an
> embedded platform then I can understand space is a concern.  If you're
> using a standard desktop computer and your database doesn't have
> millions of records it might not be.  By all means, work to your
> priorities.
>
>> 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.
>
> 'good' relative to what ?  I'm always interested in better solutions.

Yeah, 'good' is too ambiguous.

What I meant is that if a table contains several columns, some or all  
of which need to be searched using 'ends with', then replicating the  
columns (by reversing the string) and keeping extra indices could  
potentially affect performance (obviously, it depends on the number of  
rows). Also, the extra logic needed to keep track seems a bit overkill.

Perhaps I should be consider FTS instead. I'd like to play with the  
idea of matching a particular string using FTS and then and query the  
result set using 'ends with' (i.e.  LIKE '*foo'). This way the query  
would scan the FTS result set, as opposed to the entire table.

Thanks again,

-- Tito

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

Reply via email to