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.

Chapter 1: Storing and Managing Unstructured DataOne <strong>of</strong> the big advantages that the file system can <strong>of</strong>fer, when handling LOB data, isstreaming. <strong>The</strong> streaming <strong>of</strong> data refers to transferring it in a manner that allows itto be processed as the data is transferred, rather than collecting all the data before theprocessing begins. Streaming significantly increases the performance <strong>of</strong> read and writeoperations on that data.<strong>SQL</strong> <strong>Server</strong> cannot stream LOB data. When a chunk <strong>of</strong> LOB data is written, <strong>SQL</strong> <strong>Server</strong>creates a memory buffer large enough to hold the data, accepts all the data, and only thenstarts writing it into the database. Similarly, when LOB data is read, <strong>SQL</strong> <strong>Server</strong> createsa memory buffer large enough to hold the LOB value, reads all the data into the bufferand then sends it to the client connection that requested the data. So, to read or write a500 MB LOB value from or to a column, <strong>SQL</strong> <strong>Server</strong> needs to allocate 500 MB <strong>of</strong> memorybuffer to read or write the value.Exceptionally large objects, or multiple simultaneous requests to read or write LOBdata, can cause severe memory pressure and possibly result in the dreaded "insufficientmemory" error. Keep in mind that <strong>SQL</strong> <strong>Server</strong> is optimized for I/O operations involving8 KB pages, not massive objects. In any scenario, such queries can slow down otherqueries and affect overall server performance.A piece <strong>of</strong> Micros<strong>of</strong>t research which studied the performance differences between storingLOB data in the database and in the file system found that file system is the preferredoption for storing LOB data if the size is 1 MB or above.To BLOB or not to BLOB?You can find the Micros<strong>of</strong>t Research Paper, one <strong>of</strong> Jim Gray's last projects before he disappeared at sea, ToBLOB or Not To BLOB: Large Object Storage in a Database or a File System at http://brurl.com/fs2.36

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

Saved successfully!

Ooh no, something went wrong!