Professional Cloud Database Engineer Practice Questions

Google Cloud Professional Cloud Database Engineer exam preparation

Professional Cloud Database Engineer practice questions in English: 180 questions with explanations. The mock exam has 60 questions and 120 minutes.

Professional Cloud Database Engineer free question 2 / 10 · Domain 1: Design innovative, scalable, and highly available cloud database solutions

You are adding a foreign key in Spanner, and the referenced column already has a secondary index that a user created. Which statement about index management for the foreign key is correct?

  1. Foreign key validation scans the base table, and no supporting index is created for it
  2. You specify the name of the user-created index in the foreign key definition
  3. The foreign key creates its own backing index and does not use the existing user index
  4. If a user index exists on the same column, it is reused as the index for the foreign key
Show the answer and explanation

Answer: C

Why this is correct
The Foreign key characteristics section of the foreign keys overview says that a foreign key does not use a secondary index created by the user, and instead creates its own backing index. The backing index can be used for query evaluation and with force_index, and its name can be looked up in INFORMATION_SCHEMA. Even if an index on the same column already exists, a separate index is created for the foreign key, so you plan for that extra storage and write cost.

Why the other options are wrong
"If a user index exists on the same column, it is reused as the index for the foreign key" … A foreign key does not use an index that a user created. Even when an index on the same column exists, a separate one is built for the foreign key.
"Foreign key validation scans the base table, and no supporting index is created for it" … It is wrong that no index is created for the foreign key. You should evaluate the additional storage and write overhead.
"You specify the name of the user-created index in the foreign key definition" … The design does not let a foreign key definition name a user index of your choice. Spanner manages the index that it needs.

Key point
You can find managed indexes by checking SPANNER_IS_MANAGED in INFORMATION_SCHEMA. A managed index cannot be dropped or changed the way an ordinary index can.

Go to the Professional Cloud Database Engineer practice app (10 free questions; purchase unlocks all questions)

See the full practice set