On 24 Aug 2009, at 5:05am, Tito Ciuro wrote:

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

You might find, when you analyse just why you need to match endings,  
that you could match on any part of the string instead.  In that case  
you could just concatenate all the strings together and use LIKE to do  
some initial filtering, then narrow down the initial set in your own  
software.

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

Sure.  FTS would do it.  Another way would be to write your own  
extension to SQLite which did exactly the matching you wanted.  This  
would be annoying but provide you with a custom-written function which  
worked very quickly.

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

Reply via email to