Save audio in SQL Server?

Is it good to store audio files (mp3, wav) in SQL Server as a BLOB? One of the advantages is the storage space on your hard drive. Does it affect scalability or performance?

+1
source share
4 answers

No, this is not a good idea. Variable-sized areas (such as TEXT and BLOB) have all sorts of effects. The best approach is to store files on disk and simply maintain a link to them in the database table. Hard disk space is currently so cheap (especially compared to CPU and I / O performance) that it shouldn't even be a problem.

+5
source

I think it depends on how your application is developed. If you intend to frequently extract audio files (or update them), this can be a serious performance hit, as the audio files can be quite large. Why don't you put them in a shared network folder and just save the file path in the database? Hard disk space is cheap, SQL bandwidth and performance are not. If you have no good reason to store them in a database (and I don’t think it’s saving space on your hard drive), you better store them locally or along a common path.

+1
source

If you have the opportunity to upgrade to SQL 2008 (that is, if you are licensed for free updates), then FILESTREAM is the best choice - it puts “links” in a column, but uses a regular file system to actually store data.

In SQL 2005 or earlier, I would not do this. I do not see how this will save hard disk space; 5 megabytes is 5 megabytes, whether it is a file on disk or somewhere in the database column; the latter simply makes the transition difficult, and, as others have said, can adversely affect your overall database performance. I suppose that some minor overhead of the file system, such as minimum cluster sizes, but for large files (especially audio) the effect is negligible.

+1
source

If you are using Sql Server 2008, you can use the filestream attribute. Sql Server will save the file to the file system, but will associate it with the 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 available via the Internet Archive at https://web.archive.org /web/20120530062012/http://www.aghausman.net/sql_server/configure-sql-server-2008-for-file-stream-2.html )

+1
source

Source: https://habr.com/ru/post/1341651/


All Articles