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 reference documentation for the \u003ccode\u003eTransactionOptions.Types.ReadWrite.Types.ReadLockMode\u003c/code\u003e enum within the Google Cloud Spanner v1 API.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version documented is 5.0.0-beta05, with version 4.6.0 being the current version shown, while a history of versions dating back to 3.5.0 are available.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eReadLockMode\u003c/code\u003e enum is used to define the locking behavior for read-write transactions, and it has three possible values: \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 mode does not lock on reads, but instead locks on commit, while \u003ccode\u003ePessimistic\u003c/code\u003e mode acquires locks immediately on read, and \u003ccode\u003eUnspecified\u003c/code\u003e will default to the \u003ccode\u003ePessimistic\u003c/code\u003e read lock.\u003c/p\u003e\n"],["\u003cp\u003eThis enum is found within the \u003ccode\u003eGoogle.Cloud.Spanner.V1\u003c/code\u003e namespace and is contained in the \u003ccode\u003eGoogle.Cloud.Spanner.V1.dll\u003c/code\u003e assembly.\u003c/p\u003e\n"]]],[],null,[]]