文件保存在文件系统VS数据库中 [英] File save on File System VS In Database

查看:168
本文介绍了文件保存在文件系统VS数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个用于文件(图像,文档等)下载的servlet(或Struts2中的动作)。
但我想知道哪个是更好的方法来保持文件在文件系统和数据库只是保持文件的路径或保持文件在数据库中的文件,如BLOBs。
我知道,当我在数据库查询数据库blob是慢,
,但如果我保持在数据库这将是我更容易备份数据,并保证一致性。
有什么建议?

解决方案

我从来没有用过BLOB。例如。我只是将用户上传的照片正常存储在目录中。我没有看到使用BLOB存储文件的很多理由。你说备份可能更容易 - 相反,这可能会变得非常有问题,至少在我们的情况下,因为我们有很多GB的照片,但数据库必须保持相当小,以便能够经常备份和与PHPMyAdmin。


I'm designing a servlet(or action in Struts2) for file(images, documents, etc...) download. But I'm wondering which is better approach to keep files on File system and in database just keep the path to the file OR to keep the files in the database like BLOBs. I know that when I do query on database where is blobs is slower, but if I keep in database It would me it easier to backup the data and guarantee consistency. Any suggestions?

解决方案

I never used a BLOB. E.g. I just store user uploaded photos normally in directories. I don't see much reason for using a BLOB for storing files. You say it could be easier to backup - on the contrary, that could become very problematic, at least in our case as we have many GB of photos, but the database must be kept rather small in order to be able to backup it often and with PHPMyAdmin.

这篇关于文件保存在文件系统VS数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆