Re: %Like%
| From: | Michael Dearman | Date: | Thu, 13 Jul 2000 14:25:26 +0000 |
| Subject: | Re: %Like% | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1104@lists.php.net to get a copy of this message | ||
Craig Vincent wrote:
>
> <snip>
> Don't know about the O(n). In Paul Dubois' book,
> he recommends not using the double %what% unless that's
> actually what you need. It's got something to do with
> better optimization if you can use the what% form.
> </snip>
>
> Hey Mike,
>
> You're absolutely right. When you do a query using LIKE , if you use the
> '%foo%' format, MySQL will NOT use any indexes on that column and hence
> there probably be a slowdown if the server needs to do a full table scan and
> there's a lot of records to sift through. I actually believe '%foo' also
> will not use an Indexes.
>
> Sincerely,
>
> Craig Vincent
>
Hi Graig,
Yep. That's the way I read it. Thanks for making that clearer.
So - keep those '%'s on the end of the pattern for the best mileage
and better dental hygiene. ;)
Mike D.