0
我試圖運行這個SELECT
語句,但我需要數小時才能執行。我也在這些表上創建了索引。SELECT語句需要幾小時才能執行
SELECT DISTINCT
j.Name AS State,
l.DisplayName AS ServiceCenter,
l.JurisdictionID,
e.LocationID,
ConvictionStateID AS RegionId,
FeeGroupID,
e.VehicleID ,
ServiceDate,
evd.EventlogID,
v.ClientID,
e.EventLogServiceID,
evd.EventlogDetailID,
EvtDT AS EventDate,
EvtVal AS EventValue,
evd.EventLogCodeID,
UPPER(SerialNumber) AS SerialNumber,
UPPER(RelayNum) AS RelayNumber,
edp.FileName,
GPSLatitude
FROM
[MM\PLUSREPORT5].lsa_plus_jur_nico.dbo.EventLogDetail evd
INNER JOIN
[MM\PLUSREPORT5].lsa_plus_jur_nico.dbo.EventLog e ON evd.EventlogID = e.EventlogID
INNER JOIN
[MM\PLUSREPORT5].lsa_plus_jur_nico.dbo.Vehicle v ON e.VehicleID = v.VehicleID
INNER JOIN
[MM\PLUSREPORT5].lsa_plus_jur_nico.dbo.Client c ON v.ClientID = c.ClientID
INNER JOIN
[MM\PLUSREPORT5].lsa_plus_base.dbo.Location l ON e.LocationID = l.LocationID
INNER JOIN
[MM\PLUSREPORT5].lsa_plus_base.dbo.Jurisdiction j ON l.JurisdictionID = j.JurisdictionID
LEFT JOIN
[MM\PLUSREPORT5].lsa_plus_jur_nico.dbo.EventLogDetailPhoto edp ON evd.EventLogDetailId = edp.EventLogDetailId
Excution plan,也嵌入在下面。
請張貼**表結構**和**索引創建腳本** –
我加入七個表一起如何張貼表結構 – ALE
請你可以幫助重寫查詢,以避免哈希匹配成像我有所有關鍵列索引 – ALE