-- 对于所有本应该走索引的,当mysql发现通过索引扫描的行记录数超过全表的10%-30%时,优化器可能会放弃走索引,自动变成全表扫描
-- 1. =走索引,!=、也走索引
explain select id2 from user where varchar_short4 = '0'; -- = 范围小,肯定走索引。ref。key_len=11
explain select id2 from user where varchar_short4 = '0000'; -- = 范围大,肯定走索引。ref
explain select id2 from user where varchar_short4 != '0000'; -- != 范围小, 走索引。range
explain select id2 from user where varchar_short4 != '0'; -- != 范围大, 不走索引。
-- 2. 、>=、 '1'; -- 走索引,key_len=11
explain select id2 from user2 where varchar_short7 > '1' and varchar_short8 = '0' and varchar_short9 = '0';-服务器托管网- 走索引,key_len=33
explain select id2 from user2 where varchar_short7 like '1%' -- 走索引,key_len=11
explain select id2 from user2 where varchar_short7 like '1%' and varchar_short8 = '0' and varchar_short9 = '0'; -- 走索引,key_len=33
explain select id2 from user2 where varchar_short7 = '0' or varchar_short8 = '0'; -- 不走索引
explain select id2 from user ;
explain select * from user where bigint2 = 1 limit 1;
explain select distinct id2 from user where id2 > '1';
explain select id2 from user limit 100,1;
select * from user;
explain select id2 from user where id2 = '1'; -- =范围小,肯定走索引服务器托管网。const
explain select id2 from user where id2 != '1'; -- =范围小,肯定走索引。const
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: CAD快捷键命令大全:加载插件、图层管理器及变动快捷键
1: cad加载插件快捷键命令 cad加载插件快捷键命令 在AutoCAD(2016)中,通过快捷键命令服务器托管网”ap”可以加载插件。 加载方法: 打开CAD,输入加载插件快捷键命令”ap”,回车。 进入插件加载对话框。 选择永久性加载来一次性加载插件,不…