良い一日!
List<TotalServiseCalls> TSC = (
from scall in contextOMNIDB.UserFields698.AsEnumerable()
where scall.f2_creationd >= referenceDate
group scall by scall.f2_creationd.Month into scalls
select new TotalServiseCalls
{
mountN = (from sc in contextOMNIDB.UserFields698.AsEnumerable()
where sc.f2_creationd.Month == scalls.Key
select sc.f2_creationd).FirstOrDefault(),
date = (from sc in contextOMNIDB.UserFields698.AsEnumerable()
where sc.f2_creationd.Month == scalls.Key
select sc.f2_creationd.ToString("MMMM yyyy")).FirstOrDefault(),
totalCount = scalls.Count()
}).OrderBy(p => p.mountN).ToList();
MSSQL サーバーには多くのアプリケーションがあり、その負荷は非常に高くなっています。このクエリは 40 秒間実行されます。これは、サーバーの混雑によるものですか、それともクエリの複雑さによるものですか?
テーブルには約 1 万のレコードがあり、サイズは 1 メガバイトです。