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