In SQL Server 2005, you only have the choice of using VARBINARY(MAX) to store files inside a database table or save them externally.
The obvious drawback of leaving them outside the database is that the database cannot really control what happens to them; they can be moved, renamed, deleted .....
SQL Server 2008 introduces the FILESTERAM attribute in the VARBINARY(MAX) types, which allows you to leave files outside the database table, but is still under transactional database management - for example, you cannot just delete files from disk, files are an integral part of the database and thus will be copied and copied with it. Great if you need it, but it can do for huge backups! :-)
The SQL Server 2008 release introduced some โbest practicesโ as to when to store material directly in the database, and when to use FILESTREAM. It:
- If the file size is usually less than 256 KB, it is best to use a database table
- If the file size usually exceeds 1 MB or may have a size of more than 2 GB, then your best bet would be FILESTREAM (or in your case: a plain old file system)
- no recommendations for files between these two fields
In addition, in order not to adversely affect the performance of your queries, it is often useful to place large files in a separate alltogether table - not have huge blocks that will be part of your regular tables that you query - but rather create a separate table with which you only ever asking if you really need megabytes of documents or images.
So, this can give you an idea of โโwhere to start!
source share