Question is old and i guess has no 100% right answer. But would like to hear more experienced advice.
Using SQL Server 2008 R2.
I have table where will be stored millions of rows. Most of the columns is description (date, status, title, ..) of varbinary(max) column data. There are also 2 columns of XML data type. these XML’s are small and will be queried often. So:
MyTable
(
SomeID varchar(20)-- queried most often
Date DateTime -- queried most often
Status VarChar(10) -- queried most often
Title VarChar(50) -- queried most often
-- some more columns here
SomeSmallXML xml -- queried quite often
SomeOtherSmallXML xml -- queried quite often
MyData varbinary(max) -- queried rarely
MyOtherData varbinary(max) -- queried rarely
)
IF i move all large value types to other table:
- can do online reindexing of clustered index. But then i have to move also xml types to
other table. as they are queried quite often, its does not seem
reasonable. (i expect fragmentation, because SomeID column is coming
from client app. Its not reasonable to make other surrogate key as
clustered index, so SomeID will be key of clustered index.) - can move large data to slower storage. But guess can achieve
the same by table partitioning (old data in slow filegroup) + indexes
on fast storage.
In this case do not see very good reasons to move large value data types to other table.
i do see reason to set “sp_tableoption N’MyTable’, ‘large value types out of row’, ‘ON'”.
What is your advice? What else i have to take in account?
I made decision based on discussion with other colleagues: separated SOME of LOB data (also SomeID and Date columns) in separated data in other table.
Most important: i missed to consider update rate of columns and how long data is queried often and when they get old enough not to be interesting in vast majority (but not all) cases.
And that is what makes difference in this case.
So came up with:
So, as can see, some LOB data- MyData and MyOtherData varbinary(max) gets static after short time. They are large enough, so i would like to store them on cheep disk and put on read only partition at some point of time. As more recent is Date, as more often i need “MyData” or “MyOtherData”.
So final design looks approximately like this: