我的SQL查询:mysql fix使用where;
SELECT *
FROM updates_cats
WHERE uid =118697835834
ORDER BY created_date ASC
当前指数:
index1(uid, created_date)
EXPLAIN EXTENDED结果:
1 SIMPLE updates_cats ref index1 index1 8 const 2 100.00 Using where
如何解决它已经用在那里,因此它可以使用额外的字段索引呢?
编辑:SHOW CREATE TABLE:
CREATE TABLE `updates_cats` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`u_cat_id` bigint(20) NOT NULL DEFAULT '0',
`uid` bigint(20) NOT NULL,
`u_cat_name` text COLLATE utf8_unicode_ci NOT NULL,
`total_updates` int(11) unsigned NOT NULL DEFAULT '0',
`created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `index1` (`uid`,`created_date`)
) ENGINE=MyISAM AUTO_INCREMENT=23522 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
+1。虽然删除了PHP标记。 – 2012-03-02 13:11:35
@fxuser:表格有多少行?如果他们太少,那么eindex可能不会被起诉。 – 2012-03-02 13:46:22
@ypercube显示第0 - 29行(总共23,521,查询花了0.0005秒) – fxuser 2012-03-02 13:49:07