Google Cloud Professional Cloud Database Engineer — Question 156

You are migrating your on-premises PostgreSQL database to Spanner. You need to identify a solution for handling existing integer-based table primary keys. You want minimal changes to the applications while also following Google-recommended practices. What should you do?

Answer options

Correct answer: D

Explanation

The correct answer is D because generating values with BIT_REVERSED_POSITIVE sequences ensures that the primary keys are unique and can be efficiently managed in Spanner. Option A suggests using application-generated integers, which could lead to conflicts, while B could result in duplicate keys if not carefully managed. Option C's use of UUIDs changes the key structure significantly, deviating from the integer-based keys originally in use.