in reply to Re: Re: DBI, quoting, and LIKE searches
in thread DBI, quoting, and LIKE searches

Since these LIKE strings start with a '%', the database can't use an index at all. So that should not be a concern here.

        - tye

Replies are listed 'Best First'.
Re: (tye)Re2: DBI, quoting, and LIKE searches
by Mr_Person (Hermit) on Dec 26, 2002 at 17:41 UTC
    I see... That solution will work great for my current problem then. But, for future reference, will it use the index like it should if the LIKE string does not start with a '%'?
      Yes, your database engine will use an index (if available and depending on your query, optimisor) when you do like 'bla%'. I did read the theory on this once, but have since forgot... i guess i should hop off to google now.. :-)
        OK, so i found an article which summed it up, its pretty obvious really. To paraphrase:
        No an index won't work in the above situation - if you think about it, what benefit could an index be when your search string starts with a wildcard - at what point in the index would you begin to search?