Professional Documents
Culture Documents
03 Indexes
03 Indexes
Examples
Alter index idx_emp rebuild;
Alter index idx_emp rebuild parallel;
Alter index idx_emp rebuild nologging
Alter index idx_emp coalesce;
How to monitor if indexed is being used or not
ALTER INDEX hr.emp_last_name_idx MONITORING USAGE;
ALTER INDEX hr.emp_last_name_idx NOMONITORING USAGE;
Select index_name, used
from v$object_usage
where used= ‘NO’
Initialization parameters
Bitmap indexes are not appropriate for tables that have lots
of single row DML operations (inserts) and especially
concurrent single row DML operations. Deadlock situations
are the result of concurrent inserts as the following
example shows: Open two windows, one for Session 1 and one
for Session 2
Session 1 Session 2
create table bitmap_index_demo (
value varchar2(20)
);
insert into bitmap_index_demo
select
decode(mod(rownum,2),0,'M','F')
from all_objects;
create bitmap index
bitmap_index_demo_idx
on bitmap_index_demo(value);
insert into bitmap_index_demo
values ('M');
1 row created.
insert into
bitmap_index_demo
values ('F');
1 row created.
insert into bitmap_index_demo
values ('F');
...... waiting ......
ERROR at line 1: insert into
ORA-00060: deadlock detected bitmap_index_demo
while waiting for resource values ('M');
...... waiting ......
Function Based Index
Initialization Parameter
QUERY_REWRITE_ENABED must be set to true for function
indexes (oracle supposedly rewrites the query for
better performance. Also used for Materialized views)
OPTIMIZER_MODE=CHOOSE - Must use Cost based optimizer
Reverse Key Index
Example:
Limitations