AIFeed

数据库一行数据的生命历程:幕后究竟发生了什么

AI summary

从外部看,INSERT、UPDATE 或 DELETE 似乎只是小操作,但在数据库内部,这类请求可能涉及内存、事务日志、索引、旧行版本和后台清理,还可能牵涉其他机器。数据库需要让这些部分协同工作,同时支持并发查询并应对崩溃,因此已提交的行可能仍在等待数据页落盘,已删除的行也可能继续占用存储空间。

Translation(model translation, not the source's own text)

文章标题:数据库一行的生命周期:幕后究竟发生了什么

正文: 从外部看,INSERT、UPDATE 或 DELETE 可能像是很小的操作。你添加一行、修改一些值,或删除不再需要的内容。但在数据库内部,这样的请求可能涉及内存、事务日志、索引、旧行版本和后台清理。此外,还可能涉及其他机器。

数据库的职责是让这些部分协同工作,同时让你能够运行并发查询并应对崩溃。这就是为什么一个已提交的行可能仍在等待其数据页写入磁盘,而一个已删除的行可能继续占用存储空间。

在本文中,我们将围绕这些操作来看数据库中一行的生命周期。以下是我们要涵盖的内容:

  • 什么是行
  • 插入操作如何工作
  • WAL 的作用
  • 更新操作如何工作
  • 删除操作如何工作
  • Vacuum 与 compaction
  • 复制和备份如何工作
  • 数据库提交如何产生工作

什么是行?

Only about 564 characters could be extracted — the rest did not come through (common on sites that need scrolling or a login). Read the original for the full piece.

Published by ByteByteGo
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗