我在SQL Server 2005上的SQL查询非常慢。只需要40秒就可以进行选择。在select之后,我得到结果查询并使用此结果进行插入。每个“textField”和“Id”都是索引唯一的,每个“Id”都是PK。请问我能做些什么来获得更好的结果?谢谢!
SELECT DISTINCT
C.Id, E.Id, B.Id, A.Id
FROM
tableA AS A
INNER JOIN
tableB AS B
INNER JOIN
tableC AS C
INNER JOIN
tableD AS D ON C.textField = D.textField
INNER JOIN
tableE AS E ON D.textField = E.textField
ON B.textField = D.textField
ON A.textField = D.textField