存储文件的最佳方法

编程入门 行业动态 更新时间:2024-10-26 06:28:11
本文介绍了存储文件的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在服务器上存储上传文件的标准方法是什么?是数据库中的binary还是硬盘上的路径存储在数据库中?

What is the standard way to store uploaded files on server? In database as binary or on hard disk with path stored in database?

推荐答案

Microsoft对此主题进行了研究: www.microsoft/zh-cn/研究/出版物/将数据存储在一个数据库或文件系统中/或不将其夸大/

Microsoft did a research in this topic: www.microsoft/en-us/research/publication/to-blob-or-not-to-blob-large-object-storage-in-a-database-or-a-filesystem/

存储非常小的文件将使您在数据库中获得最佳性能.存储较大的文件可为您的硬盘提供最佳性能.我为我工作的公司进行了研究.当文件大小为512 kB或更大时,文件系统性能将比数据库更好.此后,数据库的性能将迅速下降.

Storing very small files will get you the best performance in the database. Storing larger files give you the best performance on your hard drive. I researched this for a company where I work for. The file system performance will be better than the database when the file size is 512 kB or larger. The performance of the database will drop rapidly after this point.

将文件存储在数据库中将为您提供可以使所有内容保持同步的优势.您可以配置为在删除文件记录时将删除文件BLOB.但是,存储大文件会给您带来非常糟糕的性能,并且创建备份可能会花费很长时间.

Storing files in the database will give you the advantage that you can keep everything in sync. You can configure that a file BLOB will be removed when the file record is removed. However, storing large files will give you very bad performance and creating backups could take very long.

更多推荐

存储文件的最佳方法

本文发布于:2023-10-23 06:13:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1520030.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!