Storing a UUID in Cloud Spanner
问题 I would like to use a UUID as a primary key in Cloud Spanner. What is the best way to read and write UUIDs? Is there a UUID type, or client library support? 回答1: The simplest solution is just to store it as a STRING in the standard RFC 4122 format. E.g.: " d1a0ce61-b9dd-4169-96a8-d0d7789b61d9 " This will take 37 bytes to store (36 bytes plus a length byte). If you really want to save every possible byte, you could store your UUID as two INT64's. However, you would need to write your own