如果表每天有超过50,000条记录,如何优化此查询?

时间:2019-07-12 07:13:55

标签: mysql optimization

select count(1) total 
from Leads 
where originaldate = curdate() and campaign = 78;

我已经索引了该表的原始日期列

1 个答案:

答案 0 :(得分:0)

INDEX(campaign, originaldate)

假设orignaldate的类型为DATE,则该复合索引可以采用任意顺序。