我是否应该创建一个SQL非聚集索引,ASP.NET MVC

问题描述

我在Web应用程序中进行了通配搜索,它在帮助用户搜索客户端方面非常有用。 我目前在Id列上只有索引。

我似乎越来越多地陷入僵局,这可能是由于没有正确的索引?

我有3个需要拉回数据的表(和2个已搜索的表)

public IEnumerable<Client> FindAllByWildCard(string accountId,string name)
{
    return RepositorySet
               .Include("Address")
               .Include("Invoice")
               .Where(p => (p.FirstName.ToLower().Contains(name.ToLower()) || 
                            p.LastName.ToLower().Contains(name.ToLower()) || 
                            p.Address.Line1.Contains(name) ||
                            p.Address.ZipCode.Contains(name) ||
                            p.Telephone.Contains(name))
                          && p.AccountId == accountId && !p.IsDeleted);
}

我应该创建索引吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)