Given the following table:

CREATE TABLE campaign_t (
  acct_id int(11) unsigned NOT NULL default '0',
  site_id tinyint(3) unsigned NOT NULL default '0',
  ref_id int(11) unsigned NOT NULL default '0',
  datestamp char(10) NOT NULL default '',
  raws int(11) unsigned NOT NULL default '0',
  uniques int(11) unsigned NOT NULL default '0',
  trial_signups int(11) NOT NULL default '0',
  full_signups int(11) NOT NULL default '0',
  annual_signups int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (acct_id,site_id,ref_id,datestamp),
  KEY acct_id (acct_id),
  KEY site_id (site_id),
  KEY ref_id (ref_id),
  KEY datestamp (datestamp)
) TYPE=MyISAM;

How come it doesn't use the 'datestamp' index on this query:

mysql> explain SELECT * FROM campaign_t WHERE datestamp < 20041105\g
+------------+------+---------------+------+---------+------+--------+------------+
| table      | type | possible_keys | key  | key_len | ref  | rows   | Extra      |
+------------+------+---------------+------+---------+------+--------+------------+
| campaign_t | ALL  | datestamp     | NULL |    NULL | NULL | 438166 | where used |
+------------+------+---------------+------+---------+------+--------+------------+
1 row in set (0.00 sec)

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to