Describe:
The table profit
has about 20 columns, and no big column like text
, and have two indexs:
- index
idx_uid
on columnuid
- index
uid_acc_fId_date
on columnuid,acc,fid and date
The slow query sql is:
select * from profit where (((uid='1111') and (flag=32)) and (fId='2222')) and (date='20161008') limit 1;
and the explain output is:
id:1
select_type:SIMPLE
table:profit
type:ref
possible_keys:uid_acc_fId_date
key:uid_acc_fId_date
key_len:4
ref:const
rows:267
Extra:Using where
Execute the sql with sql_no_cache
will spend about 2s, and execute the same sql with sql_no_cache
second time will spend about 0.1s.
Env:
- mysql 5.5.49-37.9,innodb,percona
- SATA HDD
- The table profit has about one million rows
- Centos 2.6 kernel
- rows count for
uid=1111
is only 270
PS:
Mysql will backup everyday at midnight, and innodb_old_blocks_time
is 0, I think the backup will flush all hot data out of buffer pool。But even so it spend too many time to do the above query。So, is it the disk problem?