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

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.

这篇关于将文件存储在数据库中而不是文件系统中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)