I have an InnoDB table with around 7M rows and size of 4GB. The structure is below(col names are hidden):
When I run the query SELECT COUNT(id) FROM table1 WHERE col7 != ''
it takes too long to return the count, somewhere between 50 and 70 seconds.
The EXPLAIN EXTENDED
report is:
The SELECT count(id) from table1
runs for about 5 seconds, but I need to use the WHERE
clause too.
My question is are those speeds normal for a server, and what can be done to speed things up, particularly the second query.
The server is running MySQL v5.6.35.