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 12: Planning, Configuration and Best PracticesVARBINARY(MAX) column. To help you make this decision, do some performance teststo compare <strong>FILESTREAM</strong> and VARBINARY(MAX) storage options based on your specificworkload and usage pattern.Keep an additional column to store the type <strong>of</strong> fileor extensionIn many cases, a <strong>FILESTREAM</strong> column is expected to store more than one type <strong>of</strong> file. Forexample, a product catalog application might store multiple types <strong>of</strong> files (.jpg, .png,etc.) in the image column, and a document management application might store multipletypes <strong>of</strong> documents (Word, Excel, etc.), and so on.An additional column that specifies the file type can be beneficial. For example, inChapter 10 we saw that full-text indexing expects an additional column in the tablethat stores the file extension. Based on the file type, the index component identifies theIFilter for the file and indexes the content. Even if you do not use full-text indexing, itmay be helpful to keep a file type column, for example to identify the content type to theclient application.Identifying the type <strong>of</strong> file from a file headerMost file types have a header section that stores various pieces <strong>of</strong> information about thecontent <strong>of</strong> the file. For example, most image file types keep a file header that specifies thetype <strong>of</strong> file, dimension <strong>of</strong> the image, and so on.While it is recommended that you keep an additional column that specifies the file type,in the real world you may end up in a situation where there is no such column. Forexample, assume that the application stores different types <strong>of</strong> images in the <strong>FILESTREAM</strong>column <strong>of</strong> a product catalog table. In the absence <strong>of</strong> an extra column which stores452

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

Saved successfully!

Ooh no, something went wrong!