标签:mysql优化
区分度高的放在前面
select count(distinct destinationmachine) cdd, count(distinct factoryname) cdf, count(distinct requesttype) cdr, count(distinct CASSETTETYPE) cdc, count(distinct state) cds from dsptransfercommand; |
CDD CDF CDR CDC CDS
---------- --------- ---------- ---------- ----------
259 4 4 2 8
Select count(*) from dsptransfercommand表计算总数
选择索引选择性好的列放在前面。
本文出自 “dba天空” 博客,请务必保留此出处http://9425473.blog.51cto.com/9415473/1661222
标签:mysql优化
原文地址:http://9425473.blog.51cto.com/9415473/1661222