i have a mysql database with about 60 Million records. i will have to generate report every day.
I have two type of sql statement.
Method1
SELECT TransferStatus as Transfer_Status, count(ID) as Count
FROM calldetails
WHERE YEAR(IVRStartTime) = '2015' AND MONTH(IVRStartTime) = '11' AND DAy(IVRStartTime)='05' AND CallTransfer LIKE '163%'
GROUP BY TransferStatus;
Method2
SELECT TransferStatus as Transfer_Status,
count(ID) as Count FROM calldetails
WHERE (IVRStartTime BETWEEN '2015-11-05 00.00.00' AND '2015-11-05 23.59.59')
AND CallTransfer LIKE '163%'
GROUP BY TransferStatus
I tried both queries both takes approximately 15 minutes to give results. My question is which one is the best to use and is there any other way i can improve the performance.