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 page provides documentation for the \u003ccode\u003eReadLockMode\u003c/code\u003e enum within the Google Cloud Spanner v1 API, specifically for read-write transaction options.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eReadLockMode\u003c/code\u003e enum offers three modes: \u003ccode\u003eOptimistic\u003c/code\u003e, which defers locking until commit; \u003ccode\u003ePessimistic\u003c/code\u003e, which locks immediately upon reading; and \u003ccode\u003eUnspecified\u003c/code\u003e, which defaults to pessimistic locking.\u003c/p\u003e\n"],["\u003cp\u003eThe page offers access to versioned documentation for this \u003ccode\u003eReadLockMode\u003c/code\u003e enum ranging from version 3.5.0 up to the latest beta version 5.0.0-beta05.\u003c/p\u003e\n"],["\u003cp\u003eVersion 4.4.0 is the specific version of the \u003ccode\u003eReadLockMode\u003c/code\u003e documentation that this page initially focuses on.\u003c/p\u003e\n"]]],[],null,[]]