From: "Ralph Guzman" <[EMAIL PROTECTED]>

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

mysql> desc test;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| b     | varchar(50) |      | MUL |         |       |
+-------+-------------+------+-----+---------+-------+
1 row in set (0.01 sec)

mysql> explain select * from test where b like '%two%';
+-------+--------+---------------+------+---------+------+------+-------+
| table | type   | possible_keys | key  | key_len | ref  | rows | Extra |
+-------+--------+---------------+------+---------+------+------+-------+
| test  | system | NULL          | NULL |    NULL | NULL |    1 |       |
+-------+--------+---------------+------+---------+------+------+-------+
1 row in set (0.00 sec)

mysql> explain select * from test where find_in_set('two',b);
+-------+--------+---------------+------+---------+------+------+-------+
| table | type   | possible_keys | key  | key_len | ref  | rows | Extra |
+-------+--------+---------------+------+---------+------+------+-------+
| test  | system | NULL          | NULL |    NULL | NULL |    1 |       |
+-------+--------+---------------+------+---------+------+------+-------+
1 row in set (0.00 sec)

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to