Index Management
Index Management
1 Ali 45 BWP 5 22
2 Usama 87 LHR 6 30
3 Usman 48 BWP 1 45
4 Ahmed 64 BWP 3 48
5 Amir 22 BWP 4 64
6 Umer 30 LHR 2 87
Types of Index
Simple Index
Composite Index
Unique Index
Reversing Index
Function based Index
Bitmap Index
Simple Index
Index create on single column. e.g., sale from employee table ,marks from student
table, etc.
Query
Create INDEX IDX_SALARY on employee(sale);
Searching in index, not table
Composite Index
Index creates on multiple columns on any table.
Query
Create INDEX idx_s.no_rollNo on students(s.no, rollNo);
Unique Index
Index creates on columns ----- no duplication
Query
Create UNIQUE INDEX idx_mobileNo on customers_dtls(mobile);
Reversing Index
Want to search data frequently looking for highest value.
Normally List values------- beginning, Highest value---------ending
Its searching is fast because its work in reversing order.
Based on Binary tree.------ right to left in b.tree.
Create INDEX idx_sales_amt on sales(sales_amt) REVERSE;
Function based index
Work on function based.
Suppose I have a table of employee, and have a column of emp_id,salary,commission
Query
Select e_id,sal(0.100*sal) from emp
Create Index idx_sal on emp(sal(0.100*sal))init cap(ename);
Bitmap index
Bits --------- 0,1
Less number of values in columns
E.g.,
status--active/inactive,
Gender--male/female
Query
Create bitmap Index id_gender on customer(gender);
Note:
All index created based on the binary tree index.