선택도 기본공식
Col LOW LOW_VALUE HIGH HIGH_VALUE
----- -------------------- ------------------------ -------------------- ------------------------
V10 Aardvark 416172647661726B Zymurgy 5A796D75726779
C10 Aardvark 416172647661726B2020 Zymurgy 5A796D75726779202020
2 개의 행이 선택되었습니다.
PL/SQL 처리가 정상적으로 완료되었습니다.
Col End no End Value End act val
----- ------ ------------------------------------------------ --------------------------------------
C10 1 339,475,752,638,459,000,000,000,000,000,000,000
2 339,779,832,781,209,000,000,000,000,000,000,000
3 344,891,393,972,447,000,000,000,000,000,000,000
4 469,769,561,047,943,000,000,000,000,000,000,000
V10 1 339,475,752,638,459,000,000,000,000,000,000,000
2 339,779,832,781,057,000,000,000,000,000,000,000
3 344,891,393,972,447,000,000,000,000,000,000,000
4 469,769,561,047,943,000,000,000,000,000,000,000
8 개의 행이 선택되었습니다.
ASCII 256 to the power 15 - N
----- =======================
65 337,499,295,804,763,795,854,482,261,399,306,240
97 1,967,393,731,554,212,031,122,883,374,743,552
114 9,032,010,526,626,134,485,664,010,338,304
100 30,948,500,982,134,506,872,478,105,600
118 142,653,246,714,526,242,615,328,768
97 458,069,548,838,355,585,728,512
114 2,102,928,824,402,888,884,224
107 7,710,162,562,058,289,152
32 9,007,199,254,740,992
32 35,184,372,088,832
0 0
0 0
0 0
0 0
0 0
Summed value
============
339,475,752,638,459,043,065,991,628,037,554,176
PL/SQL 처리가 정상적으로 완료되었습니다.
조건절 예시 | 처리방법 | |
---|---|---|
function(colx) = 'SMITH' | 고정된 1% 선택도 | |
not function(colx) = 'SMITH' | 고정된 5% 선택도 | |
function(colx) > 'SMITH' | 고정된 5% 선택도 | |
not function(colx) > 'SMITH' | 고정된 5% 선택도 | |
function(colx) >= 'SMITH' and function(colx) < 'SMITI' | 유도된 0.25% 선택도(5%*5%) | |
function(colx) between 'SMITHA' and 'SMITHZ' | 유도된 0.25% 선택도(5%*5%) | |
not function(colx) between 'SMITHA' and 'SMITHZ' | 유도된 9.75% 선택도 (5%+5%-(5%*5%)) | |
function(colx) like 'SMITH%' | 고정된 5% 선택도 | |
not fucntion(colx) like 'SMITH%' | 고정된 5% 선택도 | |
function(colx) in ('SMITH', 'JONES') | 유도된 1.99%(1% + 1% - (1%*1%)) |
Predicate: upper(v1) = upper('SMITH')
Execution Plan
----------------------------------------------------------
Plan hash value: 1429545322
---------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
---------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 34 | 2 |
| 1 | TABLE ACCESS BY INDEX ROWID| T1 | 1 | 34 | 2 |
|* 2 | INDEX RANGE SCAN | T1_I1 | 1 | | 1 |
---------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("V1"='SMITH')
filter(UPPER("V1")='SMITH')
Note
-----
- cpu costing is off (consider enabling it)
Predicate: upper(v1) = 'SMITH'
Execution Plan
----------------------------------------------------------
Plan hash value: 1429545322
---------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
---------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 34 | 2 |
| 1 | TABLE ACCESS BY INDEX ROWID| T1 | 1 | 34 | 2 |
|* 2 | INDEX RANGE SCAN | T1_I1 | 1 | | 1 |
---------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("V1"='SMITH')
filter(UPPER("V1")='SMITH')
Note
-----
- cpu costing is off (consider enabling it)
Predicate: upper(v1) = upper(:bind_var)
Uses index in 9.2, but not in 10.1.0.4
Execution Plan
----------------------------------------------------------
Plan hash value: 3617692013
----------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
----------------------------------------------------------
| 0 | SELECT STATEMENT | | 100 | 3400 | 7 |
|* 1 | TABLE ACCESS FULL| T1 | 100 | 3400 | 7 |
----------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(UPPER("V1")=UPPER(:BIND_VAR))
Note
-----
- cpu costing is off (consider enabling it)
Predicate: upper(v1) = :bind_var
Uses index in 9.2, but not in 10.1.0.4
Execution Plan
----------------------------------------------------------
Plan hash value: 3617692013
----------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
----------------------------------------------------------
| 0 | SELECT STATEMENT | | 100 | 3400 | 7 |
|* 1 | TABLE ACCESS FULL| T1 | 100 | 3400 | 7 |
----------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(UPPER("V1")=:BIND_VAR)
Note
-----
- cpu costing is off (consider enabling it)
alter table t2 add constraint t2_ck_n1 check (n1 between 0 and 199);
explain plan for
select
count(t1.v1) ct_v1,
count(t2.v1) ct_v2
from t1, t2
where t2.n2 = 15
and t1.n2 = t2.n2
and t1.n1 = t2.n1
;
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
Plan hash value: 906334482
------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 444 | 25 |
| 1 | SORT AGGREGATE | | 1 | 444 | |
|* 2 | HASH JOIN | | 15 | 6660 | 25 |
|* 3 | TABLE ACCESS FULL| T1 | 15 | 3330 | 12 |
|* 4 | TABLE ACCESS FULL| T2 | 15 | 3330 | 12 |
------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("T1"."N2"="T2"."N2" AND "T1"."N1"="T2"."N1")
3 - filter("T1"."N2"=15 AND "T1"."N1">=0 AND "T1"."N1"<=199)
4 - filter("T2"."N2"=15)
- 강좌 URL : http://www.gurubee.net/lecture/3979
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.