UPDATE and SELECT at the same time (locked)

2

Monitoring the database (MySQL) through MONyog I realize that when a very large query is executed (SELECT ) and, at the same time, an update query also runs, under the same table, the update is waiting for the SELECT to finish.

The result of this is that the table is locked waiting (locked). And with this, all other queries under this table (currently executed) do not run until it finishes, thus causing a large system crash.

How do I solve this problem?

    
asked by anonymous 17.02.2014 / 18:16

1 answer

1

Use SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; to enable the NOLOCK feature.

SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
-- sua query...
COMMIT;

To make this feature work for all queries, place the following line in your MySQL configuration:

[mysqld]
transaction-isolation = READ-UNCOMMITTED
    
17.02.2014 / 18:20