Topic 1 Question #4
Your customer has a global chat application that uses a multi-regional Cloud Spanner instance. The application has recently experienced degraded performance after a new version of the application was launched. Your customer asked you for assistance. During initial troubleshooting, you observed high read latency. What should you do?
- A.
Use query parameters to speed up frequently executed queries.
- B.
Change the Cloud Spanner configuration from multi-region to single region.
- C.
Use SQL statements to analyze SPANNER_SYS.READ_STATS* tables.
- D.
Use SQL statements to analyze SPANNER_SYS.QUERY_STATS* tables.
Answer: C
The scenario describes unexpected high read latency on a multi-region Cloud Spanner instance following an application version update, requiring targeted performance diagnosis as the first resolution step. The suggested answer C aligns with core Professional Cloud Database Engineer troubleshooting workflows for Cloud Spanner, where you first diagnose the root cause of observed latency before implementing fixes. The SPANNER_SYS.READ_STATS* tables capture granular, end-to-end telemetry for all read operations in Spanner, including latency percentiles, lock wait times, access key ranges, replica routing details, and read type (point read, range read, transactional read), which is critical for identifying if the new application version introduced patterns like hot keys, improper read consistency settings, or misrouted reads that are driving higher latency in the multi-region deployment. Option Analysis:
A. Incorrect. Query parameters improve performance by enabling query plan caching for repeated parameterized SQL queries, but this is a targeted fix for specific inefficient queries, not a diagnostic step for generalized high read latency. There is no evidence yet that uncached query plans are the root cause, so this is premature and does not address the diagnostic requirement.
B. Incorrect. Converting a multi-region Spanner instance to single region would break the global chat application's requirement for multi-regional availability and low latency for distributed global users. This is a drastic, unsupported change without prior root cause analysis, and would not resolve the latency introduced specifically by the new application version.
C. Correct. The SPANNER_SYS.READ_STATS* introspection tables are purpose-built for diagnosing Cloud Spanner read latency issues. They capture data for all read operations, including both SQL reads and native API point/range reads common in chat applications, as well as details specific to multi-region deployments like replica serving location and consistency mode impacts. Querying these tables lets you directly isolate the root cause of the post-update read latency to implement the correct fix.
D. Incorrect. The SPANNER_SYS.QUERY_STATS* tables only capture performance data for SQL query execution, and do not include telemetry for non-SQL read operations executed via the Spanner RPC API, which are widely used in low-latency chat applications. Since the issue is generalized high read latency, not just slow SQL queries, these tables do not provide the complete dataset needed for diagnosis. Key Concepts:
1. Cloud Spanner Introspection Tables: The SPANNER_SYS schema contains built-in telemetry tables for monitoring and troubleshooting all aspects of Spanner performance, with separate tables tailored for read operations, query operations, transaction operations, and storage usage, as tested in the Professional Cloud Database Engineer exam domain of managed database troubleshooting.
2. Cloud Spanner Read Operation Types: Spanner supports two categories of read operations: SQL query reads, and native API point/range reads that do not use SQL syntax. General read latency issues require analysis of all read types, not just SQL queries, to identify root cause.
3. Multi-region Spanner Performance Diagnostics: Multi-region Spanner instances serve reads from geographically distributed replicas, so read latency can be impacted by application-level changes to consistency settings, access patterns, or routing logic, requiring read-specific telemetry to isolate issues. References:
Troubleshoot read latency in Cloud Spanner, Read stats tables