私はこのクエリを持っています.. 214実行/分、44.42平均CPU(ms)はそれをはるかに速くする方法があります
SELECT P.Id id0,
P.ProgramId ProgramId1,
P.ProgramName ProgramName2,
P.ProgramLevel ProgramLevel3,
P.Department Department4,
P.Track Track5,
P.AcademicYear AcademicYear6,
P.StartTerm StartTerm7,
P.Delivery Delivery8,
P.Fee Fee9,
P.City City10,
P.STATE State11,
P.StartDate StartDate12,
P.Deadline Deadline13,
P.DeadlineDisplay DeadlineDisplay14,
P.ProgramType ProgramType15,
O.Id as OrganizationId16,
O.NAME OrganizationName17,
P.ApplicationType ApplicationType18,
P.Concentration Concentration19,
P.ZipCode ZipCode20,
P.Campus Campus21,
P.WADisplayName WADisplayName22,
P.UpdatedDate updateDate23,
AF.Id InstanceId24,
RD.Id stateId33
INTO #TempGetFullProgramSelectionInfo
FROM unicas_config..applicationForm AF
INNER JOIN UNICAS_CONFIG.. AcademicInstitution AI
ON AF.casid=AI.casid
INNER JOIN UNICAS_CONFIG..Organization O
ON O.academicInstitutionid=AI.id
INNER JOIN UNICAS_CONFIG..AssociationOrg asOrg
ON asOrg.FormId=AF.id
INNER JOIN UNICAS_CONFIG..Program P
ON P.AssociationOrgId=asOrg.Id and asOrg.OrganizationId=O.id AND AF.Id = 6286
INNER JOIN unicas_config..ReferenceData RD
ON P.STATE = RD.ValueId AND RD.ValueAbbr ='US'
INNER JOIN unicas_config..ReferenceDataSet RS
ON RD.ReferenceSetId = RS.SetId AND RS.NAME = 'LK_States'
これを2つのクエリに分割した場合
select RD.ValueId, RD.id into #temp1
from unicas_config..ReferenceData RD
INNER JOIN unicas_config..ReferenceDataSet RS ON RD.ReferenceSetId= RS.SetId AND RS.NAME= 'LK_States'
where RD.ValueAbbr='US';
SELECT P.Id id0,
P.ProgramId ProgramId1,
P.ProgramName ProgramName2,
P.ProgramLevel ProgramLevel3,
P.Department Department4,
P.Track Track5,
P.AcademicYear AcademicYear6,
P.StartTerm StartTerm7,
P.Delivery Delivery8,
P.Fee Fee9,
P.City City10,
P.STATE State11,
P.StartDate StartDate12,
P.Deadline Deadline13,
P.DeadlineDisplay DeadlineDisplay14,
P.ProgramType ProgramType15,
O.Id as OrganizationId16,
O.NAME OrganizationName17,
P.ApplicationType ApplicationType18,
P.Concentration Concentration19,
P.ZipCode ZipCode20,
P.Campus Campus21,
P.WADisplayName WADisplayName22,
P.UpdatedDate updateDate23,
AF.Id InstanceId24,
RD.Id stateId33
INTO #TempGetFullProgramSelectionInfo
FROM unicas_config..applicationForm AF
INNER JOIN UNICAS_CONFIG.. AcademicInstitution AI
ON AF.casid=AI.casid
INNER JOIN UNICAS_CONFIG..Organization O
ON O.academicInstitutionid=AI.id
INNER JOIN UNICAS_CONFIG..AssociationOrg asOrg
ON asOrg.FormId=AF.id
INNER JOIN UNICAS_CONFIG..Program P
ON P.AssociationOrgId=asOrg.Id and asOrg.OrganizationId=O.id AND AF.Id = 6286
INNER JOIN #temp1 RD ON P.STATE= RD.ValueId;
フリスビーが推奨するクエリを使用する
ハッシュ結合の使用
クエリの実行に必要な時間はどれくらいですか?そして、なぜ毎分200回実行されるのですか?結果を一時テーブルに頻繁に保存する必要性を説明できますか?
—
ypercubeᵀᴹ
このクエリはSPにあり、一時テーブルは次のクエリで使用されます。このプロダクションでは、1分あたり約20 Kのリクエストがあります。
—
2015