Value Type | Cardinality 계산법 |
---|---|
Popular Value | Base Cardinality * (bucket count / bucket size) |
Non Popular Value | Base Cardinality * Density |
Bind 변수 - Predicate | Base Cardinality * Density - Non Popular 와 동일 |
Bind 변수 - Range Predicate | 5% rule |
존재하지 않는 값 | 최대/최소값을 기준으로 선형적으로 감소하는 방식으로 계산 |
TABLE_NAME : T1
COLUMN_NAME : C2
NUM_DISTINCT : 300
NUM_NULLS : 0
DENSITY : .00036320911154317
LOW_VALUE : C102
HIGH_VALUE : C204
HISTOGRAM : HEIGHT BALANCED
{code:SQL} C2 CNT -- -- 1 5008 2 5008 3 8 4 8 5 8 6 6 7 6 8 6 9 6 10 6 . . . {code} | {code:SQL} TABLE_NAME COLUMN_NAME ENDPOINT_NUMBER ENDPOINT_VALUE --- T1 C2 113 1() T1 C2 228 2() T1 C2 229 3() T1 C2 230 10() T1 C2 231 17() T1 C2 232 24() T1 C2 233 32() T1 C2 234 39() T1 C2 235 46() T1 C2 236 55() T1 C2 237 66() T1 C2 238 77() T1 C2 239 88() T1 C2 240 98() T1 C2 241 112() T1 C2 242 126() T1 C2 243 141() T1 C2 244 155() T1 C2 245 170() T1 C2 246 184() T1 C2 247 199() T1 C2 248 213() T1 C2 249 228() T1 C2 250 242() T1 C2 251 257() T1 C2 252 271() T1 C2 253 286() T1 C2 254 300() {code} |
SQL> explain plan for
2 select * from t1
3 where c2 = 1;
해석되었습니다.
SQL> @plan
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 4943 | 29658 | 6 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 4943 | 29658 | 6 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
1 - filter("C2"=1)
SQL> explain plan for
2 select * from t1
3 where c2 = 10;
해석되었습니다.
SQL> @plan
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 4 | 24 | 6 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 4 | 24 | 6 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
1 - filter("C2"=10)
SQL> explain plan for
2 select * from t1
3 where c2 = :b1;
해석되었습니다.
SQL> @plan
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 37 | 222 | 7 (15)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 37 | 222 | 7 (15)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
1 - filter("C2"=TO_NUMBER(:B1))
SQL> explain plan for
2 select * from t1
3 where c2 > :b1;
해석되었습니다.
SQL> @plan
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 556 | 3336 | 7 (15)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 556 | 3336 | 7 (15)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
1 - filter("C2">TO_NUMBER(:B1))
SQL> explain plan for
2 select * from t1
3 where c2 between :b1 and :b2;
해석되었습니다.
SQL> @plan
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3332582666
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 28 | 168 | 7 (15)| 00:00:01 |
|* 1 | FILTER | | | | | |
|* 2 | TABLE ACCESS FULL| T1 | 28 | 168 | 7 (15)| 00:00:01 |
---------------------------------------------------------------------------
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
---------------------------------------------------
1 - filter(TO_NUMBER(:B1)<=TO_NUMBER(:B2))
2 - filter("C2">=TO_NUMBER(:B1) AND "C2"<=TO_NUMBER(:B2))
SQL> explain plan for
2 select * from t1
3 where c2 = 400;
해석되었습니다.
SQL> @plan
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 3 | 18 | 6 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 3 | 18 | 6 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
1 - filter("C2"=400)