I have 2 millions record in my table. when i execute a query that has 3 where condition
it takes too long to response.
query :
SELECT COUNT(*)
FROM `table`
WHERE DATE(`created_at`) = '2017-08-11'
AND `type` in (4,13,15)
AND `status` = 1
execution time : 3 seconds
how can i reduce the execution time of this query or any query like this?
Edit
Table schema :
CREATE TABLE `transactions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` int(11) NOT NULL,
`status` int(11) NOT NULL DEFAULT '2',
`created_at` timestamp NULL DEFAULT NULL,
...
PRIMARY KEY (`id`),
KEY `query` (`created_at`,`type`,`status`),
KEY `query2` (`status`,`type`)
I don't know my indexing is true or not