DEV Community

dwivedialind
dwivedialind

Posted on

File locking vs Row Level Locking

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.

Top comments (0)