Why is table-level locking better than row-level locking for large tables?

后端 未结 5 1047
温柔的废话
温柔的废话 2020-12-23 16:51

According to the MySQL manual:

For large tables, table locking is often better than row locking,

Why is this? I would presume

5条回答
  •  不知归路
    2020-12-23 17:40

    from the (pre-edit) link

    Slower than page-level or table-level locks when used on a large part of the table because you must acquire many more locks

    use a row level lock if you are only hitting a row or two. If your code hits many or unknown rows, stick with table lock.

提交回复
热议问题