Thanks.  Just needed a confirmation. :-)

Cal Evans wrote:

> Yes and I believe it's explained in the manual better than I can explain it
> here.
>
> Roughly speaking, if the field contains:
>
> foobar
>
> then
>
> LIKE 'foo%' says match anything starting with foo.  Since it's STARTING with
> foo then the index can be used. Just like the Index of a book would be
> useless if you wanted to find references in a book for all words ending in
> bar.
>
> LIKE '%foo%' won't use and index either for the same reason.
>
> LIKE '%bar' is right out.
>
> HTH,
> Cal
> http://www.calevans.com
>
> -----Original Message-----
> From: --==[bMan]==-- [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 26, 2001 7:40 PM
> To: MySQL List
> Subject: Is this a normal behaviour?
>
> O.K.  I use MySQL version 3.23 (RedHat 7.0 release) and have a question
> about
> this query:
>
> 1.) [...] LIKE '%pattern'
> 2.) [...] LIKE 'pattern%'
>
> The first query does not use an index while the second does.  Is there any
> explenation for this?
>
> Thanks.
>
> --
> Bolek,
>
> URL: http://www.bolek.com
> URL: http://slash.bolek.com
> e-mail: [EMAIL PROTECTED]
> ICQ: 4086197, Address: 402905326
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

--
Bolek,

URL: http://www.bolek.com
URL: http://slash.bolek.com
e-mail: [EMAIL PROTECTED]
ICQ: 4086197, Address: 402905326




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to