[ubuntu-florida] MySQL and REGEX

j.e.aneiros jesus.aneiros at gmail.com
Tue Sep 21 18:27:13 BST 2010


Thanks for the clever observation Ryan. Perhaps to "help" the optimizer a
little maybe the REGEXP could be combined with a LIKE part in the same
query?

On Tue, Sep 21, 2010 at 11:21 AM, Ryan Parrish <ryan at stickystyle.net> wrote:

> On Tue, Sep 21, 2010 at 10:38 AM, j.e.aneiros <jesus.aneiros at gmail.com>
> wrote:
> > "A regular expression is a powerful way of specifying a pattern for a
> > complex search." (Excerpt from MySQL manual:
> > http://dev.mysql.com/doc/refman/5.1/en/regexp.html)
>
> Something to keep in mind about using a regex on a column is the mysql
> query optimizer will not use any of the available indexes, instead
> reverting to a full table scan.  So while these are good for one-off
> queries like the one described here, one should be mindful before
> putting it into a production system that gets hit a lot.
>
>
> -Ryan
> (stickystyle)
>
> --
> Ubuntu-us-fl mailing list
> Ubuntu-us-fl at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-us-fl
>



-- 
J. E. Aneiros
GNU/Linux User #190716 en http://counter.li.org
perl -e '$_=pack(c5,0105,0107,0123,0132,(1<<3)+2);y[A-Z][N-ZA-M];print;'
PK fingerprint: 5179 917E 5B34 F073 E11A  AFB3 4CB3 5301 4A80 F674
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-us-fl/attachments/20100921/c9ab232a/attachment.htm 


More information about the Ubuntu-us-fl mailing list