1* select /*+cardinality(t 1000000000)*/count(*) from t,t t1 where t.object_id=t1.object_id
SQL> /
Execution Plan
----------------------------------------------------------
Plan hash value: 791582492
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 10 | 6216 (91)| 00:01:15 |
| 1 | SORT AGGREGATE | | 1 | 10 | | |
|* 2 | HASH JOIN | | 1000M| 9536M| 6216 (91)| 00:01:15 |
| 3 | TABLE ACCESS FULL| T | 73081 | 356K| 285 (1)| 00:00:04 |
| 4 | TABLE ACCESS FULL| T | 1000M| 4768M| 2794 (90)| 00:00:34 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("T"."OBJECT_ID"="T1"."OBJECT_ID")
SQL> ed
Wrote file afiedt.buf
1* select count(*) from t,t t1 where t.object_id=t1.object_id
SQL> /
Execution Plan
----------------------------------------------------------
Plan hash value: 791582492
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 10 | 571 (1)| 00:00:07 |
| 1 | SORT AGGREGATE | | 1 | 10 | | |
|* 2 | HASH JOIN | | 73081 | 713K| 571 (1)| 00:00:07 |
| 3 | TABLE ACCESS FULL| T | 73081 | 356K| 285 (1)| 00:00:04 |
| 4 | TABLE ACCESS FULL| T | 73081 | 356K| 285 (1)| 00:00:04 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("T"."OBJECT_ID"="T1"."OBJECT_ID")
Oracle Hints-/*+cardinality()*/模拟表的数据量
最新推荐文章于 2025-05-27 10:55:28 发布