What Actually Happens When You Call INSERT?
You call INSERT. The database says OK. You move on. That acknowledgment feels instant. It feels cheap. It feels like the database just... wrote something down. But between your INSERT and that OK, ...

Source: DEV Community
You call INSERT. The database says OK. You move on. That acknowledgment feels instant. It feels cheap. It feels like the database just... wrote something down. But between your INSERT and that OK, at minimum four distinct things happened that most engineers who use databases every day have never thought about: The write was recorded in a sequential log before it touched any data structure — so a crash wouldn't lose it At least one index was updated — and that update is more expensive than the insert itself on some engines A decision was made about whether to hit the disk synchronously or defer it — a tradeoff with real latency consequences The data was placed into a structure that was chosen years ago by the database designers, and that choice explains almost every performance characteristic you've ever observed This series is about those four things. Not from a textbook — from the inside out, with real benchmark numbers at the end. The Moment of Insertion Let's start with the most bas