How does MySQL handle concurrent inserts?

后端 未结 4 1101
情歌与酒
情歌与酒 2020-12-05 06:41

I know there is one issue in MySQL with concurrent SELECT and INSERT. However, my question is if I open up two connections with MySQL and keep loading data using both of the

4条回答
  •  萌比男神i
    2020-12-05 07:02

    MySQL does support parallel data inserts into the same table.

    But approaches for concurrent read/write depends upon storage engine you use.

    InnoDB

    MySQL uses row-level locking for InnoDB tables to support simultaneous write access by multiple sessions, making them suitable for multi-user, highly concurrent, and OLTP applications.

    MyISAM

    MySQL uses table-level locking for MyISAM, MEMORY, and MERGE tables, allowing only one session to update those tables at a time, making them more suitable for read-only, read-mostly, or single-user applications

    But, the above mentioned behavior of MyISAM tables can be altered by concurrent_insert system variable in order to achieve concurrent write. Kindly refer to this link for details.

    Hence, as a matter of fact, MySQL does support concurrent insert for InnoDB and MyISAM storage engine.

提交回复
热议问题