私はこれが初めてです。内部および SSID パッケージの実行に時間がかかりすぎる次のコードがあります。
このステートメントは、最適な弁護士を見つけ (いくつかの生産性と容量の要因を考慮して)、その ID を一時テーブルに書き込むことを目的としています...しかし、時間がかかりすぎます。
助言がありますか???私も試してみました...トリガーを無効にしました
ALTER TABLE TB_TEMPLawyer DISABLE TRIGGER ALL
ALTER TABLE TB_LAWYERS DISABLE TRIGGER ALL
ALTER TABLE TB_PCRelation DISABLE TRIGGER ALL
ALTER TABLE TB_CASES DISABLE TRIGGER ALL
ALTER TABLE TB_TEMPaccount DISABLE TRIGGER ALL
INSERT INTO TB_TEMPLawyer
(LawyerAutoIDTEMP)
SELECT TOP (1) TB_LAWYERS.LawyerAutoID
FROM TB_PCRelation INNER JOIN
TB_CASES ON TB_PCRelation.PostalCode = TB_CASES.CustomerPostalCode INNER JOIN
TB_LAWYERS ON TB_PCRelation.PCLawyerID = TB_LAWYERS.LawyerID INNER JOIN
TB_TEMPaccount ON TB_CASES.Account = TB_TEMPaccount.TempAccount
WHERE (TB_CASES.LASYstatus = '2') AND (TB_CASES.LawyerID = 'NONE') AND (TB_LAWYERS.Activity = 'ACTIVE') AND
(TB_LAWYERS.Relation_Type = 'EXTERNAL') AND (TB_CASES.TotalMLUSBBexposure BETWEEN TB_LAWYERS.MINAmount AND
TB_LAWYERS.MAXamount) AND (TB_LAWYERS.CaseLimitMONTHLY >= TB_LAWYERS.CaseLimitMONTHLYactual) AND
(TB_LAWYERS.CaseLimitDAILY >= TB_LAWYERS.CaseLimitDAILYactual) AND (TB_LAWYERS.Productivity <> '0')
ORDER BY TB_LAWYERS.Productivity DESC
ALTER TABLE TB_TEMPLawyer ENABLE TRIGGER ALL
ALTER TABLE TB_LAWYERS ENABLE TRIGGER ALL
ALTER TABLE TB_PCRelation ENABLE TRIGGER ALL
ALTER TABLE TB_CASES ENABLE TRIGGER ALL
ALTER TABLE TB_TEMPaccount ENABLE TRIGGER ALL