TiDB Update and Delete Operations

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb更新、删除操作

| username: wenyi

TiDB update operation:
For non-primary key updates, a new row is added. For primary key updates, the old row is deleted and a new row is added.

TiDB delete operation:
It does not actually delete the data but marks the data as deleted.

| username: tidb菜鸟一只 | Original post link

No, right? Aren’t all updates and deletions in TiDB just adding new records? Marking the original records as historical data with MVCC?

| username: zhanggame1 | Original post link

TiDB updates do not delete; they just add a new record with a version number. The old record will be automatically cleaned up when the GC time arrives.

| username: xingzhenxiang | Original post link

In TiDB, an update is also a new record, and a delete is also a new record of deletion, but with the latest version number. Then, the GC (Garbage Collection) completes the task of reclaiming old versions.

| username: redgame | Original post link

This is like pg

| username: cassblanca | Original post link

MVCC multi-version control will not delete within the GC Life Time range.