mysql - speedup regex

Posted by Uwe on Stack Overflow See other posts from Stack Overflow or by Uwe
Published on 2010-03-08T15:50:02Z Indexed on 2010/03/08 16:06 UTC
Read the original article Hit count: 305

Filed under:
|
|

I have a table:

+--------+------------------+------+-----+---------+----------------+
| Field  | Type             | Null | Key | Default | Extra          |
+--------+------------------+------+-----+---------+----------------+
| idurl  | int(11)          | NO   | PRI | NULL    | auto_increment |
| idsite | int(10) unsigned | NO   | MUL | NULL    |                |
| url    | varchar(2048)    | NO   |     | NULL    |                |
+--------+------------------+------+-----+---------+----------------+

the select statement is:

SELECT idurl,
       url
  FROM URL
 WHERE idsite = 34
   AND url REGEXP '^https\\://www\\.domain\\.com/checkout/step_one\\.php.*'

The query needs 5 seconds on a table with 1000000 rows. Can I achieve a speedup with indexes or something else?

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql