select * from operatelog where opertime > = '2003-10-10';未使用索引的原因是因为
在你的数据表的记录中 opertime 所有的字段值是 都符合 你的 WHERE 条件的!!!!!
你试试这个语句
explain select * from operatelog where opertime > = '2003-12-10';
在你的数据表的记录中 opertime 所有的字段值是 都符合 你的 WHERE 条件的!!!!!
你试试这个语句
explain select * from operatelog where opertime > = '2003-12-10';
SELECT * FROM table_name where key_part1 > 1 and key_part1 < 90 ===============================================================================
这是在网上看到的mysql不使用索引的情况,但是我插入的时间是随机生成的,不可能所有日期都是10-10以后的,opertime > = '2003-10-10'条件至少限制了只选出25%的数据,这样做全表扫描也比用索引快?