You are on page 1of 2

IST 302

Paper Exercise 2 (PE2)


Index Strategy

You will conduct a search on a strategy to create indexes. You should be able to cover the basic
guidelines of when to create an index and on which columns. You should also compare indexes and
determine which type of index to use (i.e., B-tree index, Bitmap index, Composite indexes, and Function-
Based.) Document your work.

Index: - is schema object that can speed up the retrieval of rows by using a pointer. Index can be created
explicitly or automatically. If you do not have an index on the column then a full table scan occurs.

Ex- Create Index idx_emp_id on employees (employee_id);

When we create index:- More indexes on a table does not mean faster queries. We create index on a
table, which has large volume of data, most queries are expected to retrieve less than 2 to 4% of the
rows, and table is not updated frequently.

Columns which are usually indexed: - We create index on a column which is frequently used in where
clause.

The Column contains a wide range of values, and large number of null values. One or more columns are
frequently used together in a where clause or join condition.

Comparison between B-Tree index, Bitmap and function based index:-

Internally, a bitmap and a b tree indexes are different but functionally they are identical in that they
serve to assist Oracle in retrieving rows faster than a full-table scan and function based index is same as
b –tree index only difference in function based index we use any function like Upper, Lower ,initcap etc

The basic differences between b-tree and bitmap indexes

1- Syntax differences :- by default we create b- tree index but for bitmap index include “bitmap”

B-Tree Index – Create index idx_emp_first_name on employees (first name);

Bitmap Index - Create bitmap index idx_emp_gender on employees (gender);

Function Based Index: - Create index idx_emp_last_name on employees (upper (last_name));


Composite Index - Create index idx_employees_name on employees(employee_id,last_name);
2- Cardinality Differences: - The bitmap index is generally for columns with lots of duplicate values
(low cardinality), while b-tree indexes are best for high cardinality columns.

Sources:
1- https://docs.oracle.com/cd/B12037_01/appdev.101/b10795/adfns_in.htm
2- https://sites.google.com/a/ictedu.info/oracle-1z0-051/home/chapter-11?tmpl=%2Fsystem
%2Fapp%2Ftemplates%2Fprint%2F&showPrintDialog=1
3- http://www.dba-oracle.com/t_difference_between_btree_and_bitmap_index.htm

You might also like