Any way to select without causing locking in MySQL?

Posted by Shore on Stack Overflow See other posts from Stack Overflow or by Shore
Published on 2009-05-27T19:43:03Z Indexed on 2010/04/12 8:13 UTC
Read the original article Hit count: 292

Filed under:
|

Query:

SELECT COUNT(online.account_id) cnt from online;

But online table is also modified by an event, so frequently I can see lock by running show processlist.

Is there any grammar in MySQL that can make select statement not causing locks?

And I've forgotten to mention above that it's on a MySQL slave database.

After I added into my.cnf:transaction-isolation = READ-UNCOMMITTED the slave will meet with error:

 Error 'Binary logging not possible. Message: Transaction level 'READ-UNCOMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'' on query

So, is there a compatible way to do this?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about locking