Reputation: 971
The problem is that if I execute a select that takes minutes, all other queries are blocked in my application while my select is running, what I obviously don't want.
I wanted to see how many rows I have where a column is not NULL, in a myisam table that has 1.5 million rows, 10 GB in size. But the disk is very slow, this is why it takes so long.
select count(*) from table where column is not null;
Is it possible to run a query like this for minutes, while being able to run other queries?
Even if there is a way to run parallel queries, I suspect the slow disk will still be a problem, causing other queries to become unbearably slower.
Upvotes: 2
Views: 580
Reputation: 1963
you can avoid locking by setting the isolation level to read uncommitted in mysql.
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
select count(*)
from table
where column is not null;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ ;
Upvotes: 4