可以幫助我優化下面的LINQ聲明。我使用NHibernate作爲ORM。此聲明需要一分多鐘才能執行。它不應該花那麼多時間。請幫我優化這個Linq聲明
var inValidIntroductionDates = environment.IntroductionDateInfo.IntroductionDateDetails
.OrderByDescending(x => x.ApplicationDate)
.Where(x => x.VaccineDetail.Id == vaccine.Id &&
x.ViewInfo.Id == viewInfoDetail.ViewInfo.Id &&
x.MasterForecastInfo.Id == scenarioId &&
x.IsIntroductionDateValid == false)
.ToList();
感謝
拉出從日誌中生成的SQL和運行SQL數據庫上查詢excecution計劃。我懷疑大量的行和不正確的索引 – Rippo 2013-04-26 13:46:58