Home > Database > Mysql Tutorial > paip.索引优化---sql distict―order by法_MySQL

paip.索引优化---sql distict―order by法_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:30:36
Original
1312 people have browsed it

bitsCN.com

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
Copy after login

要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
Copy after login

 

 

我的MYSQL VER是.5.0.45-community-nt

bitsCN.com
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template