0

SQL语法如下

    DELETE V From Table1 V
INNER JOIN Table2 AS A ON A.Col1 = V.Col1 AND A.Col2 = V.Col2
AND A.Col3 = V.Col3 And A.Col4 = V.Col4
AND A.Col5 = V.Col5 AND A.Col6 = V.Col6

表 1 的信息:

  1. 行数:32,00,000
  2. NonClust_Index1_Col1
  3. NonClust_Index2_Col2
  4. NonClust_Index3_Col3
  5. NonClust_Index4_Col4
  6. NonClust_Index5_Col5
  7. 没有集群索引和主键

表 2 的信息:

  1. 行数:50,000

  2. NonClust_Index1_Col1_Col2_Col3_Col4_Col5_Col6(六列的非集群复合索引)

  3. Clust_Index2_Col1_Col2_Col3_Col4_Col5_Col6(六列上的集群复合索引)

请帮我确定这个简单的删除语法(删除语法在事务范围内)增加 TempDB 大小(>200GB)的原因是什么

4

1 回答 1

0

Just suggestion on the query performance here:

If in Table2 you have a single non-clustered index for all the columns, then it will be used only for the first column in that index, and for the rest it will not be used.

So I guess you can create the index in the same way as you have created for table1.

于 2012-09-07T06:06:01.513 回答