不好意思,语句贴错了,应该是下面这个语句:
select /*+ leading(test1) use_nl(test1 test2) */ * from test3 a, test2 b, test1 c
where b.object_name=c.object_name and a.object_name=b.object_name
select * from test3 a, test2 b, test1 c
where b.object_name=c.object_name and a.object_name=b.object_name
执行计划如下:
执行计划
----------------------------------------------------------
Plan hash value: 97064672
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 205 | 46330 | 94 (4)| 00:00:02 |
|* 1 | HASH JOIN | | 205 | 46330 | 94 (4)| 00:00:02 |
|* 2 | HASH JOIN | | 130 | 18460 | 32 (4)| 00:00:01 |
| 3 | TABLE ACCESS FULL| TEST2 | 100 | 6500 | 2 (0)| 00:00:01 |
| 4 | TABLE ACCESS FULL| TEST3 | 10000 | 751K| 30 (4)| 00:00:01 |
| 5 | TABLE ACCESS FULL | TEST1 | 20000 | 1640K| 61 (2)| 00:00:01 |
-----------------------------------------------------------------------------
按照提示应该是test1,test2连接啊。我更换了where中条件出现的顺序也不行
where a.object_name=b.object_name and c.object_name=b.object_name
之前这三个表已经做过分析了
analyze table test1 compute statistics;
analyze table test2 compute statistics;
analyze table test3 compute statistics;