4 ms·
I've always been curious, is this how atomic changes are accomplished in databases? I always figured if you changed a table, you would set up the data post-cha
by civilized 4y ago
I've always been curious, is this how atomic changes are accomplished in databases?
I always figured if you changed a table, you would set up the data post-change in a separate place, then switch a pointer to point to the new data as the very last operation.
- tremon 4y agoWhat's "this" in your question? I don't see the immediate connection between a programmer's workflow and a database row update. But your understanding of what happens inside the database engine is too simplistic: first of all, the data does not necessarily exist as only one copy because there may be multiple indexes or materialized views covering that data. And each copy needs its own pointer switch as the very last operation. Secondly, the "atomic" change you mention is only atomic from the application point of view. Multiple clients may each have their own isolation levels and execution state, which means that the in-memory "switch" to the new data may happen at different times for different connections (especially for isolation level repeatable-read).