时间:2021-07-01 10:21:17 帮助过:38人阅读
paip.索引优化---sql distict—order by法
select SQL_NO_CACHE DISTINCT ( gaopinzi.HEZI), LEFT (hezi, 1) AS lft, RIGHT (hezi, 1) AS rit FROM gaopinzi WHERE LENGTH(hezi) = 6 limit 50000
要7s中...网上说改用松散索引(复合索引) 会sbid fest...试了挂, gaopinzi force index(`all`) ,基本没效果..
函数索引应该好用着了,走十MYSQL不跟ORACLE牙十,不自此..
林吧,改为ORDER BY 形式..ONLY 0.3S
select SQL_NO_CACHE max( gaopinzi.HEZI), LEFT (hezi, 1) AS lft, RIGHT (hezi, 1) AS rit FROM gaopinzi WHERE LENGTH(hezi) = 6 group by HEZI limit 50000
我的MYSQL VER是.5.0.45-community-nt
bitsCN.com