Locks for reads within the transaction are not acquired on read.
Instead the locks are acquired on a commit to validate that
read/queried data has not changed since the transaction started.
Pessimistic
Pessimistic lock mode.
Read locks are acquired immediately on read.
Unspecified
Default value.
If the value is not specified, the pessimistic read lock is used.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis documentation page covers the \u003ccode\u003eReadLockMode\u003c/code\u003e enum within the Google Cloud Spanner v1 API, which is used to define the read lock mode for read-write transactions.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of this \u003ccode\u003eReadLockMode\u003c/code\u003e documentation is 5.0.0-beta05, with multiple prior versions listed down to 3.5.0.\u003c/p\u003e\n"],["\u003cp\u003eThere are three distinct read lock modes available: \u003ccode\u003eOptimistic\u003c/code\u003e, \u003ccode\u003ePessimistic\u003c/code\u003e, and \u003ccode\u003eUnspecified\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eOptimistic\u003c/code\u003e locking acquires locks upon commit, while \u003ccode\u003ePessimistic\u003c/code\u003e locking acquires locks immediately upon read.\u003c/p\u003e\n"],["\u003cp\u003eIf \u003ccode\u003eReadLockMode\u003c/code\u003e is left \u003ccode\u003eUnspecified\u003c/code\u003e, it defaults to \u003ccode\u003ePessimistic\u003c/code\u003e locking behavior.\u003c/p\u003e\n"]]],[],null,[]]