nerdexam
Oracle

1Z0-873 · Question #139

LOCK IN SHARE MODE should be used...

The correct answer is B. When you need a lock that allows other transactions to read the same data, but not update or. With LOCK IN SHARE MODE, InnoDB locks each selected row with a shared lock. Other transactions can still read the selected rows, but cannot update or delete them until the first transaction releases the locks, which happens when the transaction finishes. Also, if the SELECT…

Transactions and Locking

Question

LOCK IN SHARE MODE should be used...

Options

  • AWhen you need a lock that does not allow other transactions to read, update or delete the same
  • BWhen you need a lock that allows other transactions to read the same data, but not update or
  • CWhen you need a lock that allows other transactions to read, update and delete the same locked

How the community answered

(27 responses)
  • A
    7% (2)
  • B
    78% (21)
  • C
    15% (4)

Explanation

With LOCK IN SHARE MODE, InnoDB locks each selected row with a shared lock. Other transactions can still read the selected rows, but cannot update or delete them until the first transaction releases the locks, which happens when the transaction finishes. Also, if the SELECT will select rows that have been modified in an uncommitted transaction, IN SHARE MODE will cause the SELECT to block until that transaction commits.

Topics

#LOCK IN SHARE MODE#shared locks#transaction locking#SELECT locking

Community Discussion

No community discussion yet for this question.

Full 1Z0-873 Practice