(8)连接基数
1、基本的连接基数
oracle有两个公式用于连接基数的计算:
SQL> set autotrace traceonly explain;SQL> select t1.v1, t2.v1 2 from t1, t2 3 where t1.filter = 1 4 and t2.join1 = t1.join1 5 and t2.filter = 1;执行计划----------------------Plan hash value: 2959412835---------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |---------------------------------------| 0 | SELECT STATEMENT | | 1782 | 60588 | 67 (2)| 00:00:01 ||* 1 | HASH JOIN | | 1782 | 60588 | 67 (2)| 00:00:01 ||* 2 | TABLE ACCESS FULL| T2 | 198 | 3366 | 33 (0)| 00:00:01 ||* 3 | TABLE ACCESS FULL| T1 | 392 | 6664 | 33 (0)| 00:00:01 |---------------------------------------Predicate Information (identified by operation id):--------------------------------------------------- 1 - access("T2"."JOIN1"="T1"."JOIN1") 2 - filter("T2"."FILTER"=1) 3 - filter("T1"."FILTER"=1)2、实际SQL的连接基数