You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enables optionally setting the isolation level at a transaction-level to either `SERIALIZABLE` or `REPEATABLE READ`. If the isolation level is not set, Spanner will default to `SERIALIZABLE` isolation.
Copy file name to clipboardExpand all lines: README.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -237,7 +237,7 @@ and `{}` for a mutually exclusive keyword.
237
237
| Show Query Result Shape |`DESCRIBE SELECT ...;`||
238
238
| Show DML Result Shape |`DESCRIBE {INSERT\|UPDATE\|DELETE} ... THEN RETURN ...;`||
239
239
| Start a new query optimizer statistics package construction |`ANALYZE;`||
240
-
| Start Read-Write Transaction |`BEGIN [RW] [PRIORITY {HIGH\|MEDIUM\|LOW}] [TAG <tag>];`| See [Request Priority](#request-priority) for details on the priority. The tag you set is used as both transaction tag and request tag. See also [Transaction Tags and Request Tags](#transaction-tags-and-request-tags).|
240
+
| Start Read-Write Transaction |`BEGIN [RW] [ISOLATION LEVEL {SERIALIZABLE\|REPEATABLE READ}] [PRIORITY {HIGH\|MEDIUM\|LOW}] [TAG <tag>];`| See [Isolation Level](#isolation-level) for details on the isolation level. See [Request Priority](#request-priority) for details on the priority. The tag you set is used as both transaction tag and request tag. See also [Transaction Tags and Request Tags](#transaction-tags-and-request-tags).|
241
241
| Commit Read-Write Transaction |`COMMIT;`||
242
242
| Rollback Read-Write Transaction |`ROLLBACK;`||
243
243
| Start Read-Only Transaction |`BEGIN RO [{<seconds>\|<RFC3339-formatted time>}] [PRIORITY {HIGH\|MEDIUM\|LOW}] [TAG <tag>];`|`<seconds>` and `<RFC3339-formatted time>` is used for stale read. See [Request Priority](#request-priority) for details on the priority. The tag you set is used as request tag. See also [Transaction Tags and Request Tags](#transaction-tags-and-request-tags).|
You can set the isolation level at a transaction level in read-write transactions. By default `SERIALIZABLE` isolation is used for every request.
306
+
307
+
To set the isolation level for a transaction, you can use the `ISOLATION LEVEL {SERIALIZABLE|REPEATABLE READ}` keyword.
308
+
309
+
Here are some examples for transaction-level isolation.
310
+
311
+
```
312
+
# Read-write transaction with serializable isolation
313
+
BEGIN RW ISOLATION LEVEL SERIALIZABLE
314
+
315
+
# Read-write transaction with repeatable read isolation
316
+
BEGIN RW ISOLATION LEVEL REPEATABLE READ
317
+
```
318
+
319
+
Note that the transaction-level isolation level cannot be set on read-only transactions.
320
+
303
321
## Request Priority
304
322
305
323
You can set [request priority](https://cloud.google.com/spanner/docs/reference/rest/v1/RequestOptions#Priority) for command level or transaction level.
306
324
By default `MEDIUM` priority is used for every request.
307
325
308
326
To set a priority for command line level, you can use `--priority={HIGH|MEDIUM|LOW}` command line option.
309
327
310
-
To set a priority for transaction level, you can use `PRIORITY {HIGH|MEDIUM|LOW}` keyword.
328
+
To set a priority for transaction level, you can use the `PRIORITY {HIGH|MEDIUM|LOW}` keyword.
311
329
312
330
Here are some examples for transaction-level priority.
0 commit comments