在MySQL表上进行并发READ和WRITE [英] concurrent READ and WRITE on MySQL Table
问题描述
如果一个表经常从前端写入,并且同一表也必须经常搜索.两者都是至关重要的.
If a table is frequently written from front end and same table has to be as frequently searched as well. Both are performance critical.
例如可搜索的POST表的"内容"列上具有全文本索引?如果很少有用户在写帖子,则该帖子将转到同一表,然后其他用户将在表上同时搜索关键字.
For example a POST table which is searchable having Full Text index on its "content" column ? If few users are writing posts, it goes to same table and then other users will search on table same time for keywords.
Will UPDATE/INSERT operation lock SELECT queries in above case ?
数据库-MySQL
推荐答案
这取决于表的存储引擎
InnoDB支持 MVCC 和
InnoDB supports MVCC and 4 Transaction Isolation Levels
- 已读未提交
- 已读
- 可重复阅读 (默认)
- SERIALIZABLE
- READ-UNCOMMITTED
- READ-COMMITTED
- REPEATABLE-READ (default)
- SERIALIZABLE
这允许INSERT,UPDATE,DELETE和SELECT和谐地进行99.999%的时间
This allows for INSERTs, UPDATEs, DELETEs, and SELECTs to live harmoniously 99.999% of time
这是一个完全不同的竞争环境.默认情况下,每个INSERT,UPDATE和DELETE都会锁定整个表. INSERT可以通过设置 concurrent_insert <来禁用表锁定. /a>到2.(请参见 并发插入 以获取更多信息).否则,UPDATE和DELETE仍然会对全表锁定造成严重破坏.
This is a totally different playing field. By default, every INSERT, UPDATE, and DELETE locks the entire table. INSERTs can have table locking disabled by setting concurrent_insert to 2. (See Concurrent Inserts for more information). Otherwise, UPDATEs and DELETEs can still wreak some havoc doing full table locks.
这篇关于在MySQL表上进行并发READ和WRITE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!