我具有以下加入3张桌子的要求
a) Table T1 - large physical table with 100 Million rows
Index columns: C1, C2, C3 in this order
b) Table T2 - Temp table with 50 records
contains C2 & additional columns. No Index
c) Table T3 - Temp table with 100 records
contains C3 & additional columns. No Index
表T2和T3没有公共列
我试图从T1,T2,T3提取数据,如下所示:
Select T1.*, T2.*, T3.*
from T1
Inner join T2 (on T1.C2 = T2.C2)
Inner join T3 (T1.C3 = T3.C3)
where
T1.C1 = a constant value (coming from my program).
上述查询的解释表明,在T1上,仅使用1列执行索引扫描。 (我相信它是T1.C3,因为我提供了WHERE子句)
该查询执行得很好,但是花费的时间稍长。是否有更好的方法为上述要求编写查询代码?
非常感谢任何输入
您提到您正在使用临时表。您是否在临时表上运行RUNSTATS,包括