I have a table that has over 2.5 million rows and I would like to run the following SQL Statment to get the
select count(*)
from workflow
where action_name= 'Workflow'
and release_date >= '2019-12-01 13:24:22'
and release_date <= '2019-12-31 13:24:22'
AND project_name= 'Web'
group
by page_id
, headline
, release_full_name
, release_date
The problem is that it takes over 2.7 seconds to return 0 rows as expected. Is there a way to speed it up more? I have 6 more SQL Statements that are similiar so that will take almost (2.7 seconds * 6) = 17 seconds at least.
Here is my table schema
CREATE TABLE workflow
(
id
int(11) NOT NULL AUTO_INCREMENT,
action_name
varchar(100) NOT NULL,
project_name
varchar(30) NOT NULL,
page_id
int(11) NOT NULL,
headline
varchar(200) NOT NULL,
create_full_name
varchar(200) NOT NULL,
create_date
datetime NOT NULL,
change_full_name
varchar(200) NOT NULL,
change_date
datetime NOT NULL,
release_full_name
varchar(200) NOT NULL,
release_date
datetime NOT NULL,
reject_full_name
varchar(200) NOT NULL,
reject_date
datetime NOT NULL,
PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=2948271 DEFAULT CHARSET=latin1
What I'm looking for in this query is to get the count of the pages that were released last month. that have project_name = "web" and action_name = "Workflow"