问题
are there any information in the net, where i can verify how hight are the storage costs for temporal tables feature?
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?
For example. I have a row with 10 columns = storage 100 KB. I change one value of that row, thow times. I have thow rows in the historical table after that changes. Is the fill storage cost for the master und historial table then ~300KB?
Thanks for every hint!
Ragards
回答1:
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?
Here is the cite of the book Pro SQL Server Internals by Dmitri Korotkevitch that ansers your question:
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 twodatetime2
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.
So it's not
reference/links to the original values of the master table
Previous row version is just copied as it is into historical table on every mofification.
来源:https://stackoverflow.com/questions/48700772/sql-server-temporal-table-storage-costs