Re: mysql Pattern Matching
| From: | Curt Zirzow | Date: | Fri, 05 Sep 2003 18:42:17 +0000 |
| Subject: | Re: mysql Pattern Matching | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161814@lists.php.net to get a copy of this message | ||
* Thus wrote CPT John W. Holmes (holmes072000@charter.net):
> From: "Ralph Guzman" <ralph213@sbcglobal.net>
>
>
> > Is there an advantage or difference in running FIND_IN_SET() instead of
> > LIKE?
>
> Actually no, I guess there isn't. Neither one will use an index.
There will be a slight diffence in the resuls though, depending on
the term searched and the contents
id field
--- ------
1 one,two
2 fooone,footwo
3 onefoo,twofoo
>
> mysql> explain select * from test where b like '%two%';
select id from test where b like '%two%'
id
---
1
2
3
> mysql> explain select * from test where find_in_set('two',b);
select id from test where find_in_set('two',b);
id
---
1
Curt
--
"I used to think I was indecisive, but now I'm not so sure."