在数据库上存储图像 [英] Storing images on a database

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

问题描述


可能重复:

在DB中存储图片 - 是或否?

对于年龄,我被告知不要在数据库上存储图像,或者任何大的BLOB。虽然我可以理解为什么数据库不是/不是有效的,我从来没有理解为什么他们不能。如果我可以把一个文件在某个地方并引用它,为什么数据库引擎不能做同样的。我很高兴Damien Katz在最近的Stack Overflow播客中提到它,Joel Spolsky和Jeff Atwood至少默默地同意了。

For ages I've been told not to store images on the database, or any big BLOB for that matter. While I can understand why the databases aren't/weren't efficient for that I never understood why they couldn't. If I can put a file somewhere and reference it, why couldn't the database engine do the same. I'm glad Damien Katz mentioned it on a recent Stack Overflow podcast and Joel Spolsky and Jeff Atwood, at least silently, agreed.

我一直在阅读提示微软SQL Server 2008应该能够处理BLOB的高效,是真的吗?如果是,那是什么阻止我们只是存储图像,并摆脱一个问题?我可以想到的一个事情是,虽然图像可以由一个静态的Web服务器非常快地,如果它是一个文件在某个地方,当它在数据库中,它必须从数据库旅行到Web服务器应用程序(这可能比静态Web服务器),然后它的服务。应该不缓存帮助/解决最后一个问题?

I've been reading hints that Microsoft SQL Server 2008 should be able to handle BLOBs efficient, is that true? If so, what is there stopping us from just storing images there and getting rid of one problem? One thing I can think of is that while the image can be served by a static web server very quickly if it's a file somewhere, when it's in the database it has to travel from the database to the web server application (which might be slower than the static web server) and then it's served. Shouldn't caching help/solve that last issue?

推荐答案

是的,SQL Server 2008刚刚实现了一个功能,一个你提到,它被称为filestream。这是一个很好的参数的确保在数据库中存储blob,如果你确定你将只想使用SQL Server为你的应用程序(或愿意支付的价格在性能或开发新的类似层的新的DB服务器)。虽然我希望类似的图层将开始出现,如果它们不存在不同的DB服务器。

Yes, it's true, SQL Server 2008 just implemented a feature like the one you mention, it's called a filestream. And it's a good argument indeed for storing blobs in a DB, if you are certain you will only want to use SQL Server for your app (or are willing to pay the price in either performance or in developing a similar layer on top of the new DB server). Although I expect similar layers will start to appear if they don't already exist for different DB servers.

一如既往,真正的好处取决于具体的情况。如果你将服务大量相对静态的大文件,那么这种情况加缓存可能是考虑性能/可管理性组合的最佳选择。

As always what would the real benefits be depend on the particular scenario. If you will serve lots of relatively static, big files, then this scenario plus caching will probably be the best option considering a performance/manageability combo.

本白皮书介绍了SQL Server 2008的FILESTREAM功能,它允许存储和高效访问BLOB数据使用SQL Server 2008和NTFS文件系统的组合。它包括BLOB存储器的选择,配置Windows和SQL Server以使用FILESTREAM数据,将FILESTREAM与其他功能组合的注意事项以及实现细节(如分区和性能)。

This white paper describes the FILESTREAM feature of SQL Server 2008, which allows storage of and efficient access to BLOB data using a combination of SQL Server 2008 and the NTFS file system. It covers choices for BLOB storage, configuring Windows and SQL Server for using FILESTREAM data, considerations for combining FILESTREAM with other features, and implementation details such as partitioning and performance.

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

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