Storing a file in a database as opposed to the file system?(将文件存储在数据库中而不是文件系统中?)
问题描述
一般来说,与文件系统相比,将文件存储在数据库(特别是 mssql)中对性能的影响有多大?除了应用程序可移植性之外,我想不出其他原因,我希望将我的文件作为 varbinaries 存储在 SQL Server 中.
Generally, how bad of a performance hit is storing a file in a database (specifically mssql) as opposed to the file system? I can't come up with a reason outside of application portability that I would want to store my files as varbinaries in SQL Server.
推荐答案
看看这个答案:
在数据库中存储图像 - 是还是不是?
从本质上讲,空间和性能的影响可能非常大,具体取决于用户数量.此外,请记住,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.
这篇关于将文件存储在数据库中而不是文件系统中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将文件存储在数据库中而不是文件系统中?


- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01