2 ms·
I now thought that "updating a row" might be more expensive than simply deleting because UPDATE is implemented as "mark row deleted" + "insert new version of a
by codedokode 2mo ago
I now thought that "updating a row" might be more expensive than simply deleting because UPDATE is implemented as "mark row deleted" + "insert new version of a row" in a table which support multiple versions of a row (MVCC). So maybe using DELETE is actually faster - it just marks a row as "deleted in transaction X". Unless I forgot something.
- sgarland 2mo agoThat's how Postgres' (and perhaps others) MVCC works, yes. MySQL / InnoDB, however, updates tuples in-place [0], and uses the undo log to recreate older versions as needed. 0: https://dev.mysql.com/doc/refman/8.4/en/innodb-multi-versioning.html https://dev.mysql.com/doc/refman/8.4/en/innodb-multi-version...