SQL> select ename from emp where sal >= 2000;
SQL> select * from emp where sal >= 2000;
{+}포인터란?{+}{} 포인터는 어떤 곳의 메모리 주소를 말한다. 즉, 메모리의 주소를 알고 있는 것이다. 어떤 변수나 함수 등의 주소를 가리키는 개념을 포인터라고 한다.
void main( )
{
int n = 10;
int * pn = &n;
printf("%d\n", n);
printf("%d\n", *pn);
}
==Output==
10
10
SQL>drop table t;
테이블이 삭제되었습니다.
SQL>create table t
2 as
3 select * from all_objects
4 order by dbms_random.value;
테이블이 생성되었습니다.
SQL>select count(*) from t;
COUNT(*)
----------
49993
SQL>select count(*) from t
2 where owner like 'SYS%';
COUNT(*)
----------
24707
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE (cr=691 pr=0 pw=0 time=15591 us)
24707 TABLE ACCESS FULL T (cr=691 pr=0 pw=0 time=74159 us)
SQL>select count(*) from t
2 where owner like 'SYS%'
3 and object_name = 'ALL_OBJECTS';
count(*)
----------
1
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE (cr=691 pr=0 pw=0 time=4676 us)
1 TABLE ACCESS FULL T (cr=691 pr=0 pw=0 time=4654 us)
SQL>create index t_idx on t (owner, object_name);
SQL>select /*+ index(t t_idx) */ count(*) from t
2 where owner like 'SYS%'
3 and object_name = 'ALL_OBJECTS';
count(*)
----------
1
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE (cr=77 pr=76 pw=0 time=73964 us)
1 INDEX RANGE SCAN T_IDX (cr=77 pr=76 pw=0 time=73939 us)(object id 54391)
SQL>select /*+ index(t t_idx) */ count(*) from t
2 where owner like 'SYS%'
3 and ((owner = 'SYS' and object_name >= 'ALL_OBJECTS' ) or (owner >'SYS'));
count(*)
----------
14641
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE (cr=79 pr=0 pw=0 time=9708 us)
14641 CONCATENATION (cr=79 pr=0 pw=0 time=204995 us)
12905 INDEX RANGE SCAN T_IDX (cr=67 pr=0 pw=0 time=25834 us)(object id 54391)
1736 INDEX RANGE SCAN T_IDX (cr=12 pr=0 pw=0 time=5227 us)(object id 54391)
SQL>drop index t_idx;
인덱스가 삭제되었습니다.
SQL>create index t_idx on t (object_name, owner);
인덱스가 생성되었습니다.
SQL>select /*+ index(t t_idx) */ count(*) from t
2 where owner like 'SYS%'
3 and object_name = 'ALL_OBJECTS';
count(*)
----------
1
Rows Row Source Operation
------- ---------------------------------------------------
1 TABLE ACCESS BY INDEX ROWID T (cr=2 pr=0 pw=0 time=32 us)
1 INDEX RANGE SCAN T_IDX (cr=2 pr=0 pw=0 time=21 us)(object id 54393)
SQL>drop index t_idx ;
인덱스가 삭제되었습니다.
SQL> create index t_idx on t(owner);
인덱스가 생성되었습니다.
SQL> select object_id from t
2 where owner ='SYS'
3 and object_name = 'ALL_OBJECTS';
OBJECT_ID
----------
2377
Rows Row Source Operation
------- ---------------------------------------------------
1 TABLE ACCESS BY INDEX ROWID T (cr=739 pr=0 pw=0 time=39522 us)
22934 INDEX RANGE SCAN T_IDX (cr=51 pr=0 pw=0 time=12072 us)(object id 54404)
SQL>drop index t_idx ;
인덱스가 삭제되었습니다.
SQL>create index t_idx on t(owner, object_name);
인덱스가 생성되었습니다.
SQL>select object_id from t
2 where owner ='SYS'
3 and object_name = 'ALL_OBJECTS';
OBJECT_ID
----------
2377
Rows Row Source Operation
------- ---------------------------------------------------
1 TABLE ACCESS BY INDEX ROWID T (cr=4 pr=0 pw=0 time=57 us)
1 INDEX RANGE SCAN T_IDX (cr=3 pr=0 pw=0 time=49 us)(object id 54404)