Database / Google Spanner Database Interview questions
How do you troubleshoot high latency in Spanner queries?
Latency issues in Spanner usually fall into a few diagnosable buckets, so troubleshooting starts with narrowing down which one applies.
- Check Cloud Monitoring's split-level metrics for CPU and lock-wait concentration, which points to a hotspot rather than a query problem.
- Run EXPLAIN / query stats to see whether the query is hitting a full table scan instead of using an index.
- Inspect lock wait and transaction abort metrics - frequent aborts usually mean contention on the same rows from concurrent read-write transactions.
- Review read type - a strong read that could tolerate staleness is paying an unnecessary latency cost versus bounded staleness.
- Check for cross-region round trips - a client in one region hitting a leader replica in another adds fixed network latency that no query tuning fixes.
Isolating which layer, schema, query plan, contention, or topology, is responsible avoids wasted effort tuning a query when the real cause is a hot key or a distant leader replica.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
