mysql优化一则(20171130)
View Code
先提取数据到内存再做关联,所以
alter table anniversary_lottery_user_award_detail add index `idx_award_type_is_hit` (`award_type`,`is_hit`,`award_id`)
id select_type table type possible_keys key key_len ref rows Extra ------ ----------- ------ ------ --------------------- --------------------- ------- ---------------------------------- ------ ------------- 1 SIMPLE b ref idx_award_type_is_hit idx_award_type_is_hit 4 const,const 43458 Using where 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 fission_activity.b.award_id 1 Using index 1 SIMPLE a ref idx_change_type_key idx_change_type_key 769 const,fission_activity.b.award_key 1 Using where