Google Professional Cloud Database Engineer Question 186
Select 3Google Cloud PlatformYour team is managing an e-commerce platform running on Cloud SQL for PostgreSQL. You need to automate daily database backups, ensure that indexes are regularly maintained, and periodically remove unused temporary tables. Which solutions should you implement to achieve these tasks?
- A
Use Cloud Scheduler to trigger a Cloud Function that calls the Cloud SQL Admin API for backups.
- B
Set up a Cloud SQL maintenance window to automatically rebuild indexes.
- C
Use a Cloud SQL backup schedule to automate backups.
- D
Create a cron job in a Compute Engine instance to drop unused temporary tables.
- E
Implement a Cloud Function triggered by Pub/Sub to clean up temporary tables.
Show answer and explanation
Correct answers: A, C, E
Explanation
To automate database tasks effectively in Google Cloud, leveraging cloud-native solutions like Cloud Scheduler, Cloud SQL backup schedules, and Cloud Functions is recommended. These tools minimize operational overhead and integrate seamlessly with Google Cloud services. Option 1 provides a custom way to manage backups, Option 3 uses Cloud SQL's native backup scheduling feature, and Option 5 leverages event-driven automation for cleaning up temporary tables. Avoid solutions that rely on manual setups or external infrastructure unless necessary.
- A. Correct.
Using Cloud Scheduler to trigger a Cloud Function that calls the Cloud SQL Admin API is an effective way to automate backups if you require custom backup logic. This is a valid solution.
- B. Incorrect.
Cloud SQL maintenance windows are used for applying patches and updates to the database, not for rebuilding indexes. This option is incorrect.
- C. Correct.
Cloud SQL provides a built-in feature to schedule backups, which is an ideal way to automate daily backups. This is a valid solution.
- D. Incorrect.
While you could use a cron job on a Compute Engine instance, this approach introduces unnecessary complexity and operational overhead. Cloud-native solutions like Cloud Functions are preferred. This option is incorrect.
- E. Correct.
A Cloud Function triggered by Pub/Sub can be configured to clean up unused temporary tables programmatically, making it a valid solution for automating this task.