File locking vs Row Level Locking
dwivedialind
Posted on June 17, 2024
This is a submission for DEV Computer Science Challenge v24.06.12: One Byte Explainer.
Explainer
Have you ever wondered how can multiple users perform DML operations on same table at the same time? Because of row level locking in RDBMS. In RDBMS every row is a file instead of table as a file.
Rows inside a table is scattered (fragmented) all over the DB server HD, to speed up INSERT statement.
Additional Context
Consider a multi-user environment, if multiple users are inserting rows simultaneously into the same table, and if MySQL were to store the rows sequentially then it would be really slow.
That's why when you insert a row into the table, wherever it finds the free space it will store the row there.
Posted on June 17, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.