提高性能以从SQL Server检索图像 [英] Improve performance to retrieve image from SQL server

查看:93
本文介绍了提高性能以从SQL Server检索图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们的数据库中有image列,当我们尝试获取图像时,需要很长时间.有什么方法可以提高性能?

除以下内容外的任何解决方案
1.将数据存储在文件系统中,而不是将数据存储在DB中.
2.使用varbinary列而不是image列.

Hi,

we have image column in our database and when we try to retreive image, it takes very long time. Is there any way to improve performance?

Any solutions apart from the below
1. Instead of saving data in DB, store it in file system.
2. using varbinary column instead of image column.

推荐答案

每当您尝试从数据库中检索大型项目时,都会花费时间.
如您所见,最好的方法是将映像存储在文件系统中,并在数据库中保留一个位置(特别是如果这给您带来了很大的问题,因为DB文件的大小有限,大映像会吃掉快速)-但您不想这样做.

重要的是只在您真正需要它们时才检索图像-千万不要
Whenever you try to retrieve large items from a database it is going to take time.
As you have seen, the best approach is to store the image in the files system and keep a location in the DB (particularly if this is giving you a big problem, as DB files have a limited size, and big images will eat that quite quickly) - but you don''t want to do that.

The important thing is to only retrieve images when you actually need them - so never do
SELECT * FROM MyTable


始终指定一个字段列表,除非需要,否则不要包含图像.

这里有一个提示,说明了如何最大程度地减少系统中图像的加载: ^ ]


Always specify a field list, and do not include images unless you need them.

There is a tip here which explains how I minimize loading of images in my systems: On-demand loading of images from a database[^]


这篇关于提高性能以从SQL Server检索图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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