nerdexam
Oracle

1Z0-873 · Question #48

What are some properties of using LOCK TABLE?

The correct answer is A. Less work is required by the server to acquire and release locks. C. Using LOCK TABLE sometimes decreases the amount disk reads and writes needed for a group D. All tables must be locked in a single statement. An implicit lock lasts for the duration of a single query only, which is unsuitable should you want to perform a multiple-statement update that requires no interference by other clients. To handle this, you can acquire an explicit lock, which remains in effect until you release…

MySQL Locking

Question

What are some properties of using LOCK TABLE?

Options

  • ALess work is required by the server to acquire and release locks.
  • BIt can only be used with the MyISAM storage engine.
  • CUsing LOCK TABLE sometimes decreases the amount disk reads and writes needed for a group
  • DAll tables must be locked in a single statement.
  • EIt creates more disk activity.

How the community answered

(33 responses)
  • A
    85% (28)
  • B
    9% (3)
  • E
    6% (2)

Explanation

An implicit lock lasts for the duration of a single query only, which is unsuitable should you want to perform a multiple-statement update that requires no interference by other clients. To handle this, you can acquire an explicit lock, which remains in effect until you release it. Other clients cannot modify tables that you have locked. Explicit locking can improve performance for multiple statements executed as a group while the lock is in effect. First, less work is required by the server to acquire and release locks because it need not do so for each statement. It simply acquires all needed locks at the beginning of the operation, and releases them at the end. Second, for statements that modify data, index flushing is reduced. For example, if you execute multiple INSERT statements using implicit locking, index flushing occurs following each statement. If you lock the table explicitly and then perform all the inserts, index flushing occurs only once when you release the lock. This results in less disk If you need to use multiple tables while holding an explicit lock, you must lock all of them at the same time because you cannot use any unlocked tables while you hold explicit locks. Also, you must lock all the tables with a single LOCK TABLES statement. LOCK TABLES releases any locks that you already hold, so you cannot issue it multiple times to acquire multiple locks.

Topics

#LOCK TABLE#locking performance#MyISAM#table-level locking

Community Discussion

No community discussion yet for this question.

Full 1Z0-873 Practice