Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Associate Cloud Engineer All Questions

View all questions & answers for the Associate Cloud Engineer exam

Exam Associate Cloud Engineer topic 1 question 98 discussion

Actual exam question from Google's Associate Cloud Engineer
Question #: 98
Topic #: 1
[All Associate Cloud Engineer Questions]

Your customer has implemented a solution that uses Cloud Spanner and notices some read latency-related performance issues on one table. This table is accessed only by their users using a primary key. The table schema is shown below.

You want to resolve the issue. What should you do?

  • A. Remove the profile_picture field from the table.
  • B. Add a secondary index on the person_id column.
  • C. Change the primary key to not have monotonically increasing values.
  • D. Create a secondary index using the following Data Definition Language (DDL):
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
BenKenGo6
Highly Voted 2 years, 2 months ago
Selected Answer: D
Create a secondary index using the following Data Definition. If we watch the next video, he talks about a change to monotonically when we insert rows. Finally when we talk about read and we have a perdormance issues, we must create a index. https://www.youtube.com/watch?v=r6uj0HMNQNQ
upvoted 10 times
SilNilanjan
1 year, 9 months ago
Adding index for faster retrieval is a basic DBMS concept but why do we need the index on firstname and lastname as per D?
upvoted 3 times
iooj
2 months, 3 weeks ago
right, it says: This table is accessed only by a primary key. So B should be the answer
upvoted 1 times
...
...
...
Cynthia2023
Highly Voted 11 months ago
Selected Answer: C
• Hotspotting Issue: Cloud Spanner, like many distributed databases, can experience issues with what is known as "hotspotting." This happens when a large portion of read or write operations are concentrated on a specific part of the database. In this case, the sequential nature of the person_id as a primary key can lead to hotspotting because new records are continually added at the "end" of the key space, creating a hot node which can cause performance bottlenecks. • Monotonically Increasing Values: Monotonically increasing values as primary keys can exacerbate the hotspotting effect because each new entry is placed after the last, creating a write hotspot on the last node that handles the upper bound of the key range. Over time, this can lead to unbalanced read/write loads across the nodes.
upvoted 6 times
Cynthia2023
11 months ago
• Alternatives to Monotonic Keys: To mitigate this, you can use a primary key that distributes writes more evenly across the key space. This could be achieved by using a UUID (Universally Unique Identifier) or sharding the monotonically increasing identifier by combining it with another value that has a more random distribution.
upvoted 3 times
...
...
iooj
Most Recent 2 months, 3 weeks ago
Selected Answer: B
Why B: To improve read performance, we should add a secondary index on the primary key. Since we know that this table is accessed only by the primary key, this would optimize read operations. Why not C: Monotonically increasing values might create a hotspot, but this would primarily affect write operations. In fact, lookups would be easier with sequential values compared to a UUID. Additionally, it is not mentioned that users are only reading the last inserted data, which would create a read hotspot. Why not D: This approach could work, but since the table is accessed only by the primary key, there's no need to add additional fields to the index. Why not A: The profile_picture field should not significantly affect read performance.
upvoted 2 times
iooj
2 months, 3 weeks ago
oh, just found that primary key is automatically indexed by default... so I would vote for A then, hahaha
upvoted 2 times
...
...
pzacariasf7
8 months, 2 weeks ago
Selected Answer: D
D is correct for me
upvoted 1 times
...
BAofBK
1 year ago
The correct answer is C
upvoted 1 times
...
ziomek666
1 year, 1 month ago
D makes no sense. It's C
upvoted 2 times
...
Captain1212
1 year, 2 months ago
Selected Answer: C
C seems more correct
upvoted 2 times
...
dasgcp
1 year, 8 months ago
How is this a GCP question?
upvoted 4 times
Mariuselul
1 year, 7 months ago
Spanner and distribution of primary key
upvoted 1 times
...
...
temple1305
1 year, 8 months ago
Selected Answer: C
PK already has index by default, so not B. D - index by 3 fields. but users use person_id for acces, so D is wrong. So C - because monotonically increasing fields is not good candidate for PK(because index degradetion)
upvoted 2 times
...
Spiff
1 year, 8 months ago
Selected Answer: C
Based on the supplied video by others; https://www.youtube.com/watch?v=r6uj0HMNQNQ, we can see at time 1:47 that due to the slitting of the rows, a sequential primary key will create hotspots. Therefor we need a non-sequential key; e.g. hash-based key
upvoted 2 times
...
Bobbybash
1 year, 9 months ago
Selected Answer: B
B. is correct...Add a secondary index on the person_id column. Adding a secondary index on the person_id column would help resolve the read latency-related performance issues on this table. Since the table is accessed using only the primary key, creating a secondary index on the person_id column would allow Cloud Spanner to retrieve the data using the index, rather than scanning the entire table. This can significantly reduce the read latency for queries that access this table. Removing the profile_picture field or changing the primary key to not have monotonically increasing values may not necessarily resolve the performance issues related to read latency. Creating a secondary index is a more targeted solution to address the specific issue at hand. Option D is incomplete and does not provide enough information to assess its correctness.
upvoted 4 times
...
Kopy
1 year, 11 months ago
Selected Answer: C
Create a secondary index using the following Data Definition. If we watch the next video, he talks about a change to monotonically when we insert rows. Finally when we talk about read and we have a perdormance issues, we must create a index. https://www.youtube.com/watch?v=r6uj0HMNQNQ
upvoted 2 times
...
Nazz1977
1 year, 12 months ago
Selected Answer: C
I think it is C
upvoted 1 times
...
romega2
1 year, 12 months ago
Selected Answer: C
It's definetely C, D doesn't make sense here
upvoted 1 times
...
babu85
2 years ago
Choose a primary key to prevent hotspots As mentioned in Schema and data model, you should be careful when choosing a primary key to not accidentally create hotspots in your database. One cause of hotspots is having a column whose value monotonically increases as the first key part, because this results in all inserts occurring at the end of your key space. This pattern is undesirable because Spanner divides data among servers by key ranges, which means all your inserts will be directed at a single server that will end up doing all the work.
upvoted 3 times
...
mattcl
2 years ago
C https://cloud.google.com/spanner/docs/schema-design#primary-key-prevent-hotspots
upvoted 6 times
...
Sozan
2 years ago
Selected Answer: C
C is the right answer. Why? "This table is accessed only by their users using a primary key." So adding additional indexes on firstname and lastname won't help.
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...