17.07.2015 Views

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 1: Storing and ManagingUnstructured DataOne <strong>of</strong> the challenges <strong>of</strong> designing data storage <strong>of</strong> <strong>SQL</strong> <strong>Server</strong>-driven applications isthat not all data fits into the relational model. <strong>The</strong> relational model expects each tableto describe a discrete entity and each column in the table to define exactly one aspect <strong>of</strong>that entity. Much business data is less structured in nature; it is becoming increasinglycommon to need to store images, documents, and speech data (PDF, MP3, and so on)alongside the relational data.It's been possible to store this sort <strong>of</strong> unstructured data in <strong>SQL</strong> <strong>Server</strong> for a number <strong>of</strong>years, but there have always been associated difficulties. With older, large object (LOB)data types, such as TEXT, NTEXT, and IMAGE, the data was generally held out <strong>of</strong> row, i.e.on a different page from the rest <strong>of</strong> the row data. Reading and modifying the data, usingT-<strong>SQL</strong> functions such as READTEXT and WRITETEXT was painfully slow. <strong>The</strong> introduction<strong>of</strong> the large-value (MAX) data types, namely VARCHAR(MAX), NVARCHAR(MAX)and VARBINARY(MAX) improved matters somewhat and made it easier to develop applicationsthat used these LOB data types. However, it was still preferable to store theseLOBs on the file system, with only a link to the data stored in the database, in order toavoid the buffer pool pollution that arose from having such data stored inline, and alsoto take advantage <strong>of</strong> high-performance streaming, lower rates <strong>of</strong> fragmentation duringmodifications, and so on, that are <strong>of</strong>fered by file system storage.Nevertheless, storing LOBs on the file system, separately from the rest <strong>of</strong> the businessdata, was not without problems, including the fact that the data wasn't included indatabase backups and, perhaps most significantly, having the data outside the transactionalcontrol <strong>of</strong> the database meant that it was possible for the LOB data, if it weresubject to modification, to become out <strong>of</strong> sync with the structured, <strong>SQL</strong> <strong>Server</strong>-baseddata to which it related. In addition, when LOB data is stored in the file system, outsidethe control <strong>of</strong> the database administrator, any user or application with sufficient23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!