且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将文件存储在数据库而不是文件系统中?

更新时间:2023-01-22 10:45:53

p>请查看此答案:

在DB中存储图片 - 是或否?

基本上,空间和性能影响可能相当大,用户数。另外,请记住,Web服务器很便宜,您可以轻松地添加更多以平衡负载,而数据库是最昂贵和最难以扩展Web架构的一部分。

Essentially, the space and performance hit can be quite big, depending on the number of users. Also, keep in mind that Web servers are cheap and you can easily add more to balance the load, whereas the database is the most expensive and hardest to scale part of a web architecture usually.

有一些相反的例子(例如,Microsoft Sharepoint),但通常,在数据库中存储文件不是一个好主意。

There are some opposite examples (e.g., Microsoft Sharepoint), but usually, storing files in the database is not a good idea.

应用程序和/或大致知道你将有多少用户,但对于像一个公共网站随机和不可预测的东西,你可能付出高的价格在数据库中存储文件。

Unless possibly you write desktop apps and/or know roughly how many users you will ever have, but on something as random and unexpectable like a public web site, you may pay a high price for storing files in the database.