Any way to select without causing locking in MySQL?

后端 未结 8 1634
执笔经年
执笔经年 2020-11-22 15:21

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 runn

8条回答
  •  醉梦人生
    2020-11-22 15:38

    From this reference:

    If you acquire a table lock explicitly with LOCK TABLES, you can request a READ LOCAL lock rather than a READ lock to enable other sessions to perform concurrent inserts while you have the table locked.

提交回复
热议问题