Is it a good idea to store audio files (mp3, wav) in SQL Server as BLOBs? One of the merits appears to be saving Hard disk space. Does this have any impact on scalability or performance?
相关问题
- sql execution latency when assign to a variable
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
- SQL to Parse a Key-Value String
相关文章
- Entity Framework 4.3.1 failing to create (/open) a
- Code for inserting data into SQL Server database u
- Delete Every Alternate Row in SQL
- Linux based PHP install connecting to MsSQL Server
- SQL Azure Reset autoincrement
- How do we alias a Sql Server instance name used in
- Is recursion good in SQL Server?
- How can I convert a OLE Automation Date value to a
No, it's not a good idea :) Variable-sized fields (such as TEXT and BLOB) have all sorts of performance impacts. A better approach is store the files on disk and just maintain a reference to them in a DB table. Nowadays, hard drive space is so cheap (especially compared to CPU and I/O performance) that it shouldn't even be a concern.
If you are using Sql Server 2008 you can use the filestream attribute. Sql Server will store the file on the file system but link it to a varbinary column.
Check out the link below:
http://www.aghausman.net/sql_server/configure-sql-server-2008-for-file-stream-2.html (Broken link - still accessible via Internet Archive at https://web.archive.org/web/20120530062012/http://www.aghausman.net/sql_server/configure-sql-server-2008-for-file-stream-2.html)
I think it depends a lot on how your application is designed. If you are going to be retrieving the audio files often (or updating them) it could be a serious performance hit as the audio files can be quite large. Why wouldn't you put them on a shared network location instead and just store the path to the file in the database? Hard drive space is cheap, bandwidth and SQL performance isn't. Unless you have a very good reason to keep them in the database (and I don't think saving hard drive space is it) you are better off storing them locally or on a shared path.
If you have the option of upgrading to SQL 2008 (i.e. if you're licensed for free upgrades) then
FILESTREAM
is the best choice - it puts "links" in the column but uses the regular file system to actually store the data.In SQL 2005 or earlier, I wouldn't do it. I fail to see how it's going to save hard disk space, either; 5 megs is 5 megs whether it's a file on disk or sitting in a database column somewhere; the latter just makes it harder to get to, and as others have mentioned can have a negative effect on your overall DB performance. I guess there's some minor file system overhead like minimum cluster sizes, but for large files (especially audio) the effect is negligible.