我正在尝试运行此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 ,也嵌入在下方。
答案 0 :(得分:-1)
你没有得到任何并行性和排序弹出。
检查您的索引是否配置为DESC顺序。
索引的向后扫描限制是它们不能并行。
如果可能,请尝试删除DISTINCT,这可能会增加相同的限制。