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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

IntroductionWhen I first started my database career in the early 1990s, all the applications on whichI worked dealt with simple relational data, stored in a few relational tables. <strong>The</strong> mostcommonly used data types were strings, numbers, dates, and Boolean. Many <strong>of</strong> these weresingle-user applications that lived on a single computer.Soon, however, and rapidly, applications started becoming more complex, and new andmore challenging data processing requirements began to emerge. Many applicationsstarted dealing with unstructured data. Along with relational data, our applicationsneeded to be able to generate, process and serve non-relational data such as XML, images,music, videos, and so on.<strong>SQL</strong> <strong>Server</strong> 6.5 <strong>of</strong>fered two data types for storing large chunks <strong>of</strong> text and binary data,namely text and image respectively. <strong>SQL</strong> <strong>Server</strong> 7.0 added one more data type,ntext, which enabled storage <strong>of</strong> Unicode text. <strong>SQL</strong> <strong>Server</strong> 2005 added the data typesVARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX), which made reading andwriting chunks <strong>of</strong> unstructured data much simpler. Despite these improvements, thebasic underlying problem remained: <strong>SQL</strong> <strong>Server</strong> is primarily a relational databasemanagement system and optimized for processing relational data. Reading and writinglarge chunks <strong>of</strong> text/binary data within the database requires a lot <strong>of</strong> <strong>SQL</strong> <strong>Server</strong> internalmemory (buffers as big as the size <strong>of</strong> the chunk being read/written), and multiple,simultaneous requests for large blocks <strong>of</strong> data can put the server under severememory pressure.<strong>The</strong> workaround adopted by most database architects was to store the unstructured dataas disk files on the file system, and store only the path to the file in the relational table.<strong>The</strong> file system is optimized for reading and writing large files, and <strong>of</strong>fers streamingcapabilities. This solved the performance problems, but introduced new challenges. Inthis scheme, we had no way to ensure transactional consistency between relational dataand data in the file system. Also, management <strong>of</strong> backups was complicated, since thenormal database backups were only possible if accompanied by the corresponding backup<strong>of</strong> the file system.19

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

Saved successfully!

Ooh no, something went wrong!