慢查询

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

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]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值