我在MVC应用程序中有一个实体框架数据查询。 选择的一个字段是包含图像的byte []。 当我在查询中有这个字段时,查询的速度非常慢,大约30秒,没有字段需要大约2秒。 我知道这将与将数据加载到内存中有关。 我想知道是否有人对如何在没有任何大的设计更改的情况下加快查询速度有任何想法。我错过了一些简单的东西吗?
这是查询...
var tiles = (from t in context.Tiles
join o in tileIds on t.TileId equals o
join u in context.aspnet_Users on t.UserId equals u.UserId
join c in context.Checkins on t.UserId equals c.UserId
where t.AdminDeactivated == false
select new TileLite()
{
Title = t.Title,
Quote1 = t.Quote1,
TileId = t.TileId,
LikeCount = t.LikeCount,
SafeUserName = u.SafeUserName,
UserId = u.UserId,
ClientUpdateTime = t.ClientUpdateTime,
URLUserName = u.URLUserName,
CheckinTime = c.CheckinTime,
Latitude = c.Latitude,
Longitude = c.Longitude,
ProfilePhoto = u.Photo,
TileImage = t.BgImage
});
导致问题的字段是......
TileImage = t.BgImage
答案 0 :(得分:0)
感谢大家的回复。答案是他们所有人的组合。
我删除了存储数据库的图像,并使用userId作为密钥将其存储在Azure Blob存储中。
现在我已经能够从我的sql查询中删除它,因为它们加速了它们。
谢谢。