Skip to content

Instantly share code, notes, and snippets.

@yfuruyama
Created December 2, 2018 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yfuruyama/cba2b942c89fc00d228511a01d3336d1 to your computer and use it in GitHub Desktop.
Save yfuruyama/cba2b942c89fc00d228511a01d3336d1 to your computer and use it in GitHub Desktop.
+---------------------------------------------------------------------+-------------------------------------------------------------------------------------+
| tx1 | tx2 |
+---------------------------------------------------------------------+-------------------------------------------------------------------------------------+
| spanner> BEGIN; | |
| Query OK, 0 rows affected (0.03 sec) | |
| | |
| | spanner> BEGIN; |
| | Query OK, 0 rows affected (0.07 sec) |
| | |
| spanner> SELECT * FROM Accounts WHERE UserId >= 1 AND UserId <= 10; | |
| +--------+---------+----------+ | |
| | UserId | Balance | Type | | |
| +--------+---------+----------+ | |
| | 1 | 1000 | Checking | | |
| | 2 | 1000 | Checking | | |
| | 3 | 1000 | Checking | | |
| +--------+---------+----------+ | |
| 3 rows in set (3.16 msecs) | |
| | |
| | spanner> INSERT INTO Accounts (UserId, Balance, Type) VALUES (4, 1000, 'Checking'); |
| | Query OK, 1 rows affected (0.70 sec) |
| | |
| | spanner> COMMIT; |
| | <---- blocked forever! |
| | |
+---------------------------------------------------------------------+-------------------------------------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment