【发布时间】:2016-04-18 08:46:55
【问题描述】:
我目前正在尝试加入两个表,这两个表在我要加入的列中有很多不同。
这是 tsql
from AVG(Position) as Position from MonitoringGsc_Keywords as sk
Join GSC_RankingData on sk.Id = GSC_RankingData.KeywordId
groupy by sk.Id
执行计划告诉我,执行连接需要很长时间。我认为这是因为必须将第一个表中的一大组值与第二个表中的一大组值进行比较。
MonitoringGsc_Keywords.Id 有大约 60.000 个不同的值
GSC_RankingData 有大约 100.000.000 个值
MonitoringGsc_Keywords.Id 是 MonitoringGsc_Keywords GSC_RankingData.KeywordId 的主键。
那么,我可以做些什么来提高性能?
【问题讨论】:
-
对我来说这看起来不像是有效的 TSQL。你有两个从。 "从 AVG(Position) 作为 Position 从 MonitoringGsc_Keywords 作为 sk"
标签: tsql