我正在使用用于跟踪文档的 Sql Server 数据库,并试图根据 indexTables 中存储的四个值查找重复的文档。到目前为止,我所拥有的速度非常慢。有没有办法加快这个速度?
select d.ID, d2.ID
from DOCUMENTS d
inner join IndexTable1 itm on d.ID = itm.ID
inner join IndexTable2 pd on d.ID = pd.ID
inner join IndexTable3 amt on d.ID = amt.ID
inner join IndexTable4 acct on d.ID = acct.ID
inner join DOCUMENTS d2 on d.ID <> d2.ID
inner join IndexTable06 itm2 on d2.ID = itm2.ID and itm.VALUE=itm2.VALUE
inner join IndexTable07 pd2 on d2.ID = pd2.ID and pd2.VALUE = pd.VALUE
inner join IndexTable03 amt2 on d2.ID = amt2.ID and amt.VALUE = amt2.VALUE
inner join IndexTable13 acct2 on d2.ID = acct2.ID and acct.VALUE = acct2.VALUE
更多信息:运行“显示估计的执行计划”显示最大的命中来自对 IndexTable2 (37%) 和 IndexTable3(35%) 执行聚集索引搜索。