SQL 服务器 - 临时 Table - 存储成本

SQL Server - Temporal Table - Storage costs

网络上是否有任何信息可以验证临时 tables 功能的存储成本有多高?

服务器会创建已修改的 row/tuple 的完整硬拷贝吗? 或者服务器会使用 reference/links 到未修改的 master table 的原始值?

例如。我有一行 10 列 = 存储 100 KB。我更改了该行的一个值,多次。更改后,我在历史 table 中添加了行。那么 master 和 historial table 的填充存储成本是 ~300KB 吗?

感谢您的每一个提示!

拉加德

Will the server creates a the full hardcopy of the row/tuple that was modified? Or will the server use a reference/links to the original values of the master table that are not modified?

这是本书的引用 Pro SQL Server Internals 作者 Dmitri Korotkevitch 回答了您的问题:

In a nutshell, each temporal table consists of two tables — the current table with the current data, and a history table that stores old versions of the rows. Every time you modify or delete data in the current table, SQL Server adds an original version of those rows to the history table.

A current table should always have a primary key defined. Moreover, both current and history tables should have two datetime2 columns, called period columns, that indicate the lifetime of the row. SQL Server populates these columns automatically based on transaction start time when the new versions of the rows were created. When a row has been modified several times in one transaction, SQL Server does not preserve uncommitted intermediary row versions in the history table.

SQL Server places the history tables in a default filegroup, creating non-unique clustered indexes on the two datetime2 columns that control row lifetime. It does not create any other indexes on the table.

In both the Enterprise and Developer Editions, history tables use page compression by default.

所以不是

reference/links to the original values of the master table

每次修改时,前一行版本都按原样复制到历史 table 中。