Google Cloud Professional Cloud Database Engineer — Question 139
You are migrating an on-premises database to Spanner. There are a few tables, each with a few hundred records that do not have a primary key on the source database. You need to migrate all of the tables over to the news database while avoiding hot-spotting issues. What should you do?
Answer options
- A. Load the data into Spanner, and designate a primary key later based on business need.
- B. Use the GENERATE_UUID() function to generate universally unique identifier (UUID) values with the STRING(36) data type when you do the migration.
- C. During the migration, swap the order of keys so that the column that contains the monotonically increasing or decreasing value is the first key par.
- D. Migrate the tables with no primary key to maintain consistency with source.
Correct answer: B
Explanation
The correct answer is B because using the GENERATE_UUID() function ensures that each record has a unique identifier, which helps in preventing hot-spotting during the migration. Option A is incorrect as setting a primary key later may lead to issues with data consistency and hot-spotting. Option C is not ideal as it does not address the absence of unique identifiers, and option D would maintain the existing inconsistency by not introducing primary keys.