MySQL query optimization
Posted on 2011-03-10
I want to add an index to improve performance of this query.
From your experience, which index do you think I would benefit the most? MyTable has several million rows. There are maybe about 100 unique client_code, view, batch_timestamp combinations.
Please include your thoughts.
, sum(if(file_reference = null, 1, 0)) as pending
, count(*) as total
batch_timestamp >= '20110310'
and batch_timestamp < DATE_ADD('20110310', INTERVAL 1 DAY)
group by client_code, view, batch_timestamp
order by batch_timestamp ;