I answered your question with YES
... and yes, you can dynamically sample as many as you want. ....
just put it in there over and over again.
ops$tkyte%ORA10GR2> /*
ops$tkyte%ORA10GR2>
ops$tkyte%ORA10GR2> drop table t1;
ops$tkyte%ORA10GR2> drop table t2;
ops$tkyte%ORA10GR2>
ops$tkyte%ORA10GR2> create table t1 as
ops$tkyte%ORA10GR2> select object_id,
ops$tkyte%ORA10GR2> decode( mod(object_id,2), 0, 'Y', 'N' ) f1,
ops$tkyte%ORA10GR2> decode( mod(object_id,2), 0, 'N', 'Y' ) f2
ops$tkyte%ORA10GR2> from all_objects
ops$tkyte%ORA10GR2> /
ops$tkyte%ORA10GR2> exec dbms_stats.gather_table_stats( user, 'T1' );
ops$tkyte%ORA10GR2>
ops$tkyte%ORA10GR2> create table t2 as
ops$tkyte%ORA10GR2> select object_id,
ops$tkyte%ORA10GR2> decode( mod(object_id,2), 0, 'Y', 'N' ) f1,
ops$tkyte%ORA10GR2> decode( mod(object_id,2), 0, 'N', 'Y' ) f2
ops$tkyte%ORA10GR2> from t1
ops$tkyte%ORA10GR2> /
ops$tkyte%ORA10GR2> exec dbms_stats.gather_table_stats( user, 'T2' );
ops$tkyte%ORA10GR2> */
ops$tkyte%ORA10GR2> @at
ops$tkyte%ORA10GR2> column PLAN_TABLE_OUTPUT format a72 truncate
ops$tkyte%ORA10GR2> set autotrace traceonly explain
ops$tkyte%ORA10GR2> select * from t1, t2 where t1.object_id = t2.object_id and t1.f1='N' and t1.f2='N' and t2.f1='Y' and t2.f2='Y';
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 12463 | 194K| 79 (14)| 00:00:0
|* 1 | HASH JOIN | | 12463 | 194K| 79 (14)| 00:00:0
|* 2 | TABLE ACCESS FULL| T2 | 12464 | 99712 | 39 (13)| 00:00:0
|* 3 | TABLE ACCESS FULL| T1 | 12472 | 99776 | 39 (13)| 00:00:0
------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("T1"."OBJECT_ID"="T2"."OBJECT_ID")
2 - filter("T2"."F2"='Y' AND "T2"."F1"='Y')
3 - filter("T1"."F1"='N' AND "T1"."F2"='N')
<b>no dynamic sampling, we don't know that YY and NN do not exist...</b>
ops$tkyte%ORA10GR2> select /*+ dynamic_sampling(t1 3) */ * from t1, t2 where t1.object_id = t2.object_id and t1.f1='N' and t1.f2='N' and t2.f1='Y' and t2.f2='Y';
Execution Plan
----------------------------------------------------------
Plan hash value: 1838229974
------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 16 | 78 (13)| 00:00:0
|* 1 | HASH JOIN | | 1 | 16 | 78 (13)| 00:00:0
|* 2 | TABLE ACCESS FULL| T1 | 1 | 8 | 39 (13)| 00:00:0
|* 3 | TABLE ACCESS FULL| T2 | 12464 | 99712 | 39 (13)| 00:00:0
------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("T1"."OBJECT_ID"="T2"."OBJECT_ID")
2 - filter("T1"."F1"='N' AND "T1"."F2"='N')
3 - filter("T2"."F2"='Y' AND "T2"."F1"='Y')
Note
-----
- dynamic sampling used for this statement
<b>we can do table T1</b>
ops$tkyte%ORA10GR2> select /*+ dynamic_sampling(t2 3) */ * from t1, t2 where t1.object_id = t2.object_id and t1.f1='N' and t1.f2='N' and t2.f1='Y' and t2.f2='Y';
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 16 | 78 (13)| 00:00:0
|* 1 | HASH JOIN | | 1 | 16 | 78 (13)| 00:00:0
|* 2 | TABLE ACCESS FULL| T2 | 1 | 8 | 39 (13)| 00:00:0
|* 3 | TABLE ACCESS FULL| T1 | 12472 | 99776 | 39 (13)| 00:00:0
------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("T1"."OBJECT_ID"="T2"."OBJECT_ID")
2 - filter("T2"."F2"='Y' AND "T2"."F1"='Y')
3 - filter("T1"."F1"='N' AND "T1"."F2"='N')
Note
-----
- dynamic sampling used for this statement
<b>we can do table T2</b>
ops$tkyte%ORA10GR2> select /*+ dynamic_sampling(t1 3) dynamic_sampling(t2 3) */ * from t1, t2 where t1.object_id = t2.object_id and t1.f1='N' and t1.f2='N' and t2.f1='Y' and t2.f2='Y';
Execution Plan
----------------------------------------------------------
Plan hash value: 1838229974
------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 16 | 78 (13)| 00:00:0
|* 1 | HASH JOIN | | 1 | 16 | 78 (13)| 00:00:0
|* 2 | TABLE ACCESS FULL| T1 | 1 | 8 | 39 (13)| 00:00:0
|* 3 | TABLE ACCESS FULL| T2 | 1 | 8 | 39 (13)| 00:00:0
------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("T1"."OBJECT_ID"="T2"."OBJECT_ID")
2 - filter("T1"."F1"='N' AND "T1"."F2"='N')
3 - filter("T2"."F2"='Y' AND "T2"."F1"='Y')
Note
-----
- dynamic sampling used for this statement
<b>and we can do t1 and t2...</b>
ops$tkyte%ORA10GR2> set autotrace off