ITPEC FE Morning April 2022 Question 28

Topic: Databases

For the description of the lock granularity of an RDBMS below, which of the following is an appropriate combination of A and B?

Each pair of transactions that are processed in parallel updates multiple rows in a single table. When a row-level lock and a table-level lock are compared, lock contention is more likely to occur when an A -level lock is used. More RDBMS memory area is required when a B -level lock is used in order to manage the lock while transactions are being processed.

OptionAB

Explanation

A: table, B: row — a coarse lock blocks more work, while a fine lock needs more lock entries to manage.

  • •Contention (A): a table-level lock covers every row, so two transactions updating different rows of the same table still wait for each other. A row-level lock blocks only the rows actually touched, and transactions on other rows proceed. Contention is more likely with the table-level lock.
  • •Memory (B): a row-level lock needs one lock entry per locked row, and a transaction updating many rows holds many entries until it ends. A table-level lock needs one entry for the whole table. More memory is needed with the row-level lock.

Answer (c)

Why not others:

  • •(a) row, row — A is wrong: row-level locks cause less contention, since only the rows touched are locked.
  • •(b) row, table — both blanks reversed.
  • •(d) table, table — B is wrong: a table-level lock is a single entry however many rows are updated, so it needs less memory.

Key rule: Finer lock granularity gives more concurrency but more locks to manage; coarser granularity gives less overhead but more waiting.

Databases · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.