On Sun, May 05, 2002 at 03:21:59AM +0100, Donna Robinson wrote:
> 
> explain select dances.danceid, dancetitles.title from dances,
> dancetitles where dances.danceid=dancetitles.danceid and
> dancetitles.title regexp "^A" and dances.has_desc='T' order by
> title;

[snip]

> This is TERRIBLE!  But I can't figure out how to improve it.  Can
> anyone help?

REGEXP queries don't use indexes.  Change the:

 REGEXP "^A"

to

  LIKE "A%"

and it'll use the index and give you a nice speed boost.

Jeremy
-- 
Jeremy D. Zawodny, <[EMAIL PROTECTED]>
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

MySQL 3.23.47-max: up 86 days, processed 2,253,903,006 queries (301/sec. avg)

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