Database / Google Spanner Database Interview questions
Why is clock skew uncertainty critical to Spanner's TrueTime API?
TrueTime's core insight is refusing to pretend clocks are perfectly synchronized. Every physical clock, even GPS and atomic-clock-disciplined ones, drifts slightly, so instead of returning a single "current time" value that might be wrong by an unknown margin, TrueTime returns an interval [earliest, latest] and a mathematical guarantee that real time falls somewhere inside it.
That explicit uncertainty bound (epsilon), typically a few milliseconds, is exactly what commit wait is built around: Spanner deliberately delays acknowledging a commit until epsilon has definitely elapsed, guaranteeing the assigned timestamp is safely in the past everywhere before any other transaction could observe a smaller one. If Spanner instead trusted a single unsynchronized clock reading, two transactions on different machines could be assigned timestamps that don't reflect their real commit order, silently breaking external consistency without any error being raised.
The size of epsilon also has a direct performance cost: a larger uncertainty window means a longer commit wait, so Google invests heavily in GPS and atomic clock hardware specifically to keep epsilon small (single-digit milliseconds), which is why TrueTime's accuracy is treated as a first-class piece of infrastructure rather than an implementation detail.
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...
