所以我用的是一个在数据库中大量存储图像的应用程序。你对此有什么看法?我更倾向于将位置存储在文件系统中,而不是直接存储在DB中。
你认为优点和缺点是什么?
所以我用的是一个在数据库中大量存储图像的应用程序。你对此有什么看法?我更倾向于将位置存储在文件系统中,而不是直接存储在DB中。
你认为优点和缺点是什么?
当前回答
在我曾经工作过的一家公司,我们在Oracle 8i(当时是9i)数据库中存储了1.55亿张图像。7.5 tb的价值。
其他回答
您需要记住的一件事是数据集的大小。我相信Dillie-O是唯一一个稍微说到点子上的人。
如果你有一个小的,单用户的消费应用程序,那么我会说DB。我有一个DVD管理应用程序,使用文件系统(在程序文件中),它是一个PIA备份。我希望他们每次都能把它们存储在数据库中,让我选择保存文件的位置。
对于一个更大的商业应用,我会开始改变我的想法。我曾经在一家开发县书记员信息管理应用程序的公司工作。我们将图像存储在磁盘上,以一种编码格式(以处理大量文件的FS问题),基于县指定的仪器编号。这在另一个方面是有用的,因为图像可以在DB记录之前存在(由于他们的工作流程)。
和大多数事情一样:“这取决于你在做什么”
I have worked with many digital storage systems and they all store digital objects on the file system. They tend to use a branch approach, so there will be an archive tree on the file system, often starting with year of entry e.g. 2009, subdirectory will be month e.g. 8 for August, next directory will be day e.g. 11 and sometimes they will use hour as well, the file will then be named with the records persistent ID. Using BLOBS has its advantages and I have heard of it being used often in the IT parts of the chemical industry for storing thousands or millions of photographs and diagrams. It can provide more granular security, a single method of backup, potentially better data integrity and improved inter media searching, Oracle has many features for this within the package they used to call Intermedia (I think it is called something else now). The file system can also have granular security provided through a system such as XACML or another XML type security object. See D Space of Fedora Object Store for examples.
不经常编辑的小静态图像(不超过几兆)应该存储在数据库中。这种方法有几个好处,包括更容易移植(图像与数据库一起传输),更容易备份/恢复(图像与数据库一起备份)和更好的可伸缩性(一个包含数千个小缩略图文件的文件系统文件夹对我来说听起来像是可伸缩性的噩梦)。
从数据库提供图像很简单,只需实现一个http处理程序,将从DB服务器返回的字节数组作为二进制流提供服务。
正如有人已经提到的,“视情况而定”。如果数据库中的存储被认为是文件系统的1对1替代方案,那么它可能不是最佳选择。
但是,如果数据库后端将提供额外的值,而不仅仅是blob的序列化和存储,那么它可能是真正有意义的。
You may take a look at WKT Raster which is a project aiming at developing raster support in PostGIS which in turn serves as a geospatial extension for PostgreSQL database system. Idea behind the WKT Raster is not only to define a format for raster serialization and storage (using PostgreSQL system), but, what's much more important than storage, is to specify database-side efficient image processing accessible from SQL. Long story short, the idea is to move the operational weight from client to database backend, so it take places as close to storage itself as possible. The WKT Raster, as PostGIS, is dedicate to applications of specific domain, GIS.
要获得更完整的概述,请查看该系统的网站和演示文稿(PDF)。
我几乎从不把它们存储在数据库中。最好的方法通常是将映像存储在一个由中央配置变量控制的路径中,并根据DB表和主键(如果可能的话)命名映像。这给了你以下优势:
通过更新全局配置,将映像移动到另一个分区或服务器。 通过搜索图像的主键来查找与图像匹配的记录。 您的图像可以访问处理工具,如imagemagick。 在web应用程序中,您的图像可以由web服务器直接处理(节省处理)。 CMS工具和Coldfusion等网络语言可以处理本地上传。