I have the following tables:
[Table_A]
[Table_A_Changes]
The two tables are pretty large (more then 50GBs). The first one contains some data, and the second one records' changes.The database is in FULL
recovery model (AlwaysOn
).
WRITES:
[Table_A]
– constantly/many[Table_A_Changes]
– constantly/many
READS:
[Table_A]
– constantly (in 99% of the cases only data for the past 6 months)[Table_A_Changes]
– rearly (in 99% of the cases only data for the past month)
UPDATES:
[Table_A]
– constantly/many (in 99% of the cases only data for the past few months)[Table_A_Changes]
– no updates
I am going to use a cloud storage where the fast storage is too expensive to hold all the data.
So, I want to store only the the new data in [Table_A]
on fast storage, and the older data on slow/cheap storage.
Is there a way to achieve this?
Also, since the major part of the data is not (read/update
) I want to perform only partial backups on the data stored into the fast storage only.Let's say a full backup each week and a partial backup each 12 hours.
I am looking both for storage and recovery strategies (any links are welcome, too).
Best Answer
Create a new table
Table_A_Archive
with exactly the same schema asTable_A_Changes
. Partition both these tables by, say, one-month date ranges. As data becomes stale inTable_A_Changes
swap that partition out and swap it intoTable_A_Archive
. Your data retention policy can be efficiently enforced this way, too.A view which unions the two tables can make querying simpler.