Reputation: 736
How Multithreading works with MyISAM. as it supports Table level locking? If we request select from same table. How threading works in this scenario
Upvotes: 0
Views: 1333
Reputation: 142560
Separate connections get separate threads. A single connection will not use multiple threads. (MyISAM and InnoDB)
When two separate connections (threads) try to access the same table at the "same" time, some kind of locking happens.
SELECT
acquires a read lock, which prevents writes, but not other reads. (MyISAM)
INSERT
and other writes acquire a write lock, preventing anything (writes or reads) from working with the table. (MyISAM)
When a connection is blocked, it waits, then eventually runs. (MyISAM)
InnoDB, with its row-level locking (and no table-level locking) allows more concurrency, but has other complexities.
Without a good reason, everyone should move from MyISAM to InnoDB.
Upvotes: 1