Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
613 views
in Technique[技术] by (71.8m points)

SQL Server - Temporal Table - Storage costs

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...