filter-fodder: <sql,query>
Hi,

I am trying to speed things up a bit by indexing, but am having a bit of 
trouble.

Take two tables:

TABLE dances (
  danceid   smallint(5) unsigned NOT NULL auto_increment,
  ddref     smallint(5) unsigned NOT NULL default '0', 
  has_desc  enum('T','F') NOT NULL default 'F',
 ... ...
PRIMARY KEY (danceid),
) TYPE=MyISAM;

TABLE dancetitles (
  dtid    smallint(5) unsigned NOT NULL auto_increment,
  danceid smallint(5) unsigned NOT NULL default '0',
  title   varchar(80) NOT NULL default '',
  PRIMARY KEY (dtid),
  INDEX danceidx (danceid)
) TYPE=MyISAM;

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;
==>
| table           | type | possible_keys  | key            | key_len 
| dances       | ALL  | PRIMARY           | NULL         |    NULL 
| dancetitles | ref    | danceidx            | danceidx   |       2 
-----------------------------------------------------------------------------
ref                         | rows    | Extra 
NULL                    | 10235 | where used; Using temporary; Using filesort
dances.danceid |     1      | where used 

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

Donna


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