desc select count(distinct(uid)),sum(item3) from user_credit_20130203 where (action='CreditBuy' or action='Credit' or action='CostCredit') and item6>=31 and item6<=60 and item1>=16 and item1<=20 and item4=0 and zoneid=0 and type='CostCredit_CW'\G
[url]http://space.itpub.net/12457158/viewspace-753687[/url]
distinct
group by
执行时间0.02s
执行时间0.00s
对于or 和 in的解释,官方文档
[url]http://dev.mysql.com/doc/internals/en/optimizer-primary-optimizations.html[/url]
主题:mysql性能优化-慢查询分析、优化索引和配置
[url]http://www.iteye.com/topic/1129447[/url]
[url]http://space.itpub.net/12457158/viewspace-753687[/url]
distinct
group by
select type,sum(credit) from credit_tmp where uid=1272800715289245 group by type
执行时间0.02s
select type,sum(credit) from credit_tmp where uid=1541051459059686 and
(type = 'AccArmyCr' or type='AccMinePrc' or type='AccUpgrade' or type='BIP' or type='BRTOPUP' or type='CostCredit_bigmaize'
or type='CostCredit_CW' or type='CostCredit_FREWARD' or type='CostCredit_gaojilabazhou' or type='CostCredit_GENERAL'
or type='CostCredit_gongxifacai' or type='CostCredit_jinchui' or type='CostCredit_LY' or type='CostCredit_MAP'
or type='CostCredit_supermaize' or type='CostCredit_yibenwanli' or type='ENL' or type='MaxEnergy' or type='RecoverArmy'
or type='RepairBld' or type='sciencelevelup' or type='yellowgunbuff') group by type
执行时间0.00s
对于or 和 in的解释,官方文档
[url]http://dev.mysql.com/doc/internals/en/optimizer-primary-optimizations.html[/url]
主题:mysql性能优化-慢查询分析、优化索引和配置
[url]http://www.iteye.com/topic/1129447[/url]