order by desc特别慢,未走索引
SELECT `id`,`name`,`mobile`,`sex`,`status`,`file_id`,`department_id`,`user_id`,`customer_type_id`,`age`,`remarks`,`is_house`,`is_car`,`is_insurance`,`money_demand`,`last_time`,`create_time`,`allot_time`,`city`,`comment`,`is_read`,`reset_time`,`memo` FROM `crm_customer` WHERE `is_rubbish` IS NULL AND `is_public` = 1 AND `is_quit` IS NULL AND `is_deleted` = 0 AND `department_id` IN (119,120,121,118) ORDER BY last_time desc LIMIT 120,20; |
mysql已经增加了查询字段的联合索引和last_time字段的索引,但是explain不走索引,增加了mysql配置项innodb_buffer_pool_size的大小,参考链接
https://card.weibo.com/article/m/show/id/2309404849143448469686