我有一个包含大约 64 个 child 的并行流程,每个 child 都需要将数据插入登陆表。我目前正在使用 MySQL MyISAM 引擎,并且在插入前后禁用键。
但是,这似乎是我流程中的一个巨大瓶颈。我相信 MySQL 会为每个插入锁定表,因此进程一直在等待写入。
插入是独立的,不存在插入冲突的危险。这也不需要交易或任何类似性质的东西。
是否有不同的引擎或方法来提高 MySQL 的插入/写入性能?
我想过为每个进程实例化一个表,但这会使代码更复杂,而且这不是我的风格....
如有任何建议,我们将不胜感激。
谢谢!
最佳答案
根据 INSERT DELAYED
Syntax 记录:
The
DELAYED
option for theINSERT
statement is a MySQL extension to standard SQL that is very useful if you have clients that cannot or need not wait for theINSERT
to complete.
[ deletia ]
Another major benefit of using
INSERT DELAYED
is that inserts from many clients are bundled together and written in one block. This is much faster than performing many separate inserts.
关于mysql - 将数据并发插入 MySQL 的更快方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13975132/