所以我用的是一个在数据库中大量存储图像的应用程序。你对此有什么看法?我更倾向于将位置存储在文件系统中,而不是直接存储在DB中。
你认为优点和缺点是什么?
所以我用的是一个在数据库中大量存储图像的应用程序。你对此有什么看法?我更倾向于将位置存储在文件系统中,而不是直接存储在DB中。
你认为优点和缺点是什么?
当前回答
数据数据库
文件的文件系统
其他回答
这取决于你要存储的图像数量和它们的大小。我曾经使用数据库存储图像,我的经验是相当不错的。
在我看来,使用数据库存储图像的优点是,
A.你不需要FS结构来保存你的图像 B.当存储更多的项时,数据库索引比FS树执行得更好 C.智能调优的数据库在缓存查询结果方面表现良好 D.备份很简单。如果您设置了复制,并且内容从用户附近的服务器传递,那么它也可以很好地工作。在这种情况下,不需要显式同步。
如果你的图像很小(比如< 64k),并且你的db的存储引擎支持内联(记录中)blob,它可以进一步提高性能,因为不需要间接(实现了引用的局部性)。
当您处理少量大尺寸图像时,存储图像可能是一个坏主意。在db中存储图像的另一个问题是,像创建、修改日期这样的元数据必须由应用程序处理。
The word on the street is that unless you are a database vendor trying to prove that your database can do it (like, let's say Microsoft boasting about Terraserver storing a bajillion images in SQL Server) it's not a very good idea. When the alternative - storing images on file servers and paths in the database is so much easier, why bother? Blob fields are kind of like the off-road capabilities of SUVs - most people don't use them, those who do usually get in trouble, and then there are those who do, but only for the fun of it.
在数据库中只存储映像的文件路径的问题是,不能再强制数据库的完整性。
如果文件路径所指向的实际映像变得不可用,则数据库会不知不觉地出现完整性错误。
考虑到图像是被寻找的实际数据,并且它们可以在一个集成的数据库中更容易地管理(图像不会突然消失),而不必与某种文件系统(如果文件系统是独立访问的,图像可能会突然“消失”),我倾向于将它们直接存储为BLOB或类似的文件系统。
我个人会将大数据存储在数据库之外。
优点:存储所有东西在一个请,容易访问数据文件,容易备份 缺点:降低数据库性能,很多页面分割,可能导致数据库损坏
我负责一些管理许多TB图像的应用程序。我们发现在数据库中存储文件路径是最好的。
这里有几个问题:
database storage is usually more expensive than file system storage you can super-accelerate file system access with standard off the shelf products for example, many web servers use the operating system's sendfile() system call to asynchronously send a file directly from the file system to the network interface. Images stored in a database don't benefit from this optimization. things like web servers, etc, need no special coding or processing to access images in the file system databases win out where transactional integrity between the image and metadata are important. it is more complex to manage integrity between db metadata and file system data it is difficult (within the context of a web application) to guarantee data has been flushed to disk on the filesystem