问题描述
我知道这个问题曾被问过一次。
我阅读了整篇文章,但仍然无法达到一个点。
我在做一个网站,将允许用户下载壁纸和歌曲。没有人会上传那些壁纸/歌曲,除了我。我的意思是说,用户不会上传他们。现在。每个文件平均为6Mb(歌曲)。
现在,你想在这里做什么?
在我看来,你应该存储路径而不是blob。但是它又取决于许多其他事情
- 你有自己的服务器吗?或者你在其他地方托管它?这些东西在DB中作为blob是非常关键的吗?
- >文件系统是有管理文件,在你的情况下歌曲和图像不是非常关键。并想象如果你的数据库将在大小上增长,性能会下降。如果对象平均大于一兆字节,NTFS比SQL Server有一个明显的优势
还要记住,备份您的数据库,这可能是一个很大的头痛在某些阶段。另一方面,如果你的歌曲文件在磁盘上,那将是很容易。
此外,如果您只存储数据库中的路径,也可以考虑将您的歌曲和图片保存在其他服务器(或多个服务器)上。
简而言之,我可以看到许多优点使用文件系统来存储歌曲和图片。
I know this question has been asked any a times.
I read this whole post but still couldn't reach to a point.
I am making a website which will allow users to download the wallpapers and songs. No one else will upload those wallpapers/songs except me. I mean to say that the users will not be uploading them. At present. Each file on an average is 6Mb(for songs).
Now, what would you prefer to do here? Store them as blob files or use file paths?
In My opinion you should store path in instead of blob. But again it depends upon many other things- Do you have your own server? or you are hosting it on somewhere else ? Are these things really critical to put as blob in DB ? What will be your backup strategy etc..
I have my own reasoning
- File system is there to manage files and in your case songs and images are not very critical. and imagine if your database will grow in size the performance will go down. If objects are larger than one megabyte on average, NTFS has a clear advantage over SQL Server
Also keep in mind when you have to take backup of your database it may be a big headache at some stage. On the other hand if your songs file are on disk then it will be easy.
Also if you are storing just the path in database, you can consider to keep your songs and picture on some other server (or multiple servers) as well.
In short, I can see many advantages to use file system to store songs and pictures.
这篇关于数据库:图像文件为blob还是文件路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!