Google Professional Cloud Database Engineer Question 167
Select 3Google Cloud PlatformYou are managing a Cloud SQL PostgreSQL instance that is experiencing increased traffic and higher query latencies during peak business hours. You have been tasked with improving the database's performance and scalability. Which of the following options can you consider to scale the database effectively in Google Cloud?
- A
Increase the machine type for the database instance to a higher tier with more CPUs and memory.
- B
Enable read replicas to distribute read queries across multiple instances.
- C
Use Cloud Spanner to horizontally scale the database across multiple regions.
- D
Partition the database into smaller, independent datasets using sharding techniques.
- E
Migrate the database to BigQuery for better scalability and query performance.
Show answer and explanation
Correct answers: A, B, D
Explanation
To scale a Cloud SQL PostgreSQL instance effectively, you can either scale up by increasing the machine type to provide more resources or scale out by enabling read replicas or implementing sharding. These options address the increased traffic and query latencies while maintaining the current database architecture. Migrating to solutions like Cloud Spanner or BigQuery involves changing the database type and use case, which is not directly relevant to the scenario.
- A. Correct.
Increasing the machine type (scaling up) is a valid option to improve performance by providing more CPU and memory resources to the database instance.
- B. Correct.
Enabling read replicas (scaling out) can help distribute read workloads, reducing the load on the primary instance and improving query performance.
- C. Incorrect.
Cloud Spanner is a globally distributed database, but migrating to it is not a direct scaling solution for a Cloud SQL instance. It requires significant architectural changes and is not a straightforward option for the given scenario.
- D. Correct.
Sharding (scaling out) is a useful technique to partition the database into smaller, independent datasets, which can improve scalability. However, it requires careful design and implementation.
- E. Incorrect.
BigQuery is designed for data warehousing and analytics, not for transactional workloads. Migrating to BigQuery is not suitable for scaling a Cloud SQL PostgreSQL instance.