An engineer must prevent other sessions from reading or modifying an Amazon RDS for PostgreSQL table throughout a maintenance transaction. Which action meets this requirement?
Show the answer
Correct answerB. Acquire an ACCESS EXCLUSIVE lock on the table.
AWhy not this: FOR UPDATE row locks do not block ordinary reads and do not protect the whole table from access.
BWhy this is right: ACCESS EXCLUSIVE conflicts with the locks required for ordinary reads and writes and is held until transaction end.
CWhy not this: SERIALIZABLE isolation controls transaction anomalies rather than preventing other sessions from accessing the table.
DWhy not this: A SHARE table lock blocks common data modifications but permits ordinary reads.
An ACCESS EXCLUSIVE table lock conflicts with every table lock mode, including the ACCESS SHARE lock used by ordinary reads, and remains held until the transaction ends. FOR UPDATE row locks block conflicting row changes but allow ordinary reads.