I have one old MyISAM table where when I submit some count query, table gets locked. If I do the same query, on the same InnoDB table, query gets executed fast. The problem is, the old MyISAM table is still used in production and is under heavy load, while the new one is not.
Now we come to my problem and question. When I do explain on query's executed in both tables I get some result that confuses me.
Here is the query that I am executing in both tables :
SELECT COUNT(*)
FROM table
WHERE vrsta_dokumenta = 3
AND dostupnost = 0
Here is the explain from the old MyISAM table:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE old_table ref idx_vrsta_dokumenta idx_vrsta_dokumenta 1 const 564253 Using where
And here is the explain from the new InnoDB table:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE new_table ref idx_vrsta_dokumenta idx_vrsta_dokumenta 1 const 611905 Using where
As you can see the rows count in new table is higher than in old.
So in the case that higher number is bad, does this mean that query on the new table will be slower once it is fully in use ?
In case the higher number is good, then maybe that is the reason why new table is faster, and MyISAM gets locked after some time of execution.
Anyway, what is correct? What does this rows count mean?
EDIT: the old table has twice more columns than the new one. Since the old is has been split into 2 tables.