Oracle基礎學習筆記(二)(Index)

Oracle automatically create a B-tree Index for Primary key or the column which has UNIQUE constraint.

 

CREATE [UNIQUE] INDEX index_name ON

tab_name(col_name[, col_name ...])

TABLESPACE tab_space;

 

Creating a Funtion-Based Index

ex :

CREATE INDEX i_name ON tab_name(UPPER(col_name));

 

note : need to enable the parameter QUERY_REWRITE_ENABLED (it is false by default)

ALTER SYSTEM SET QUERY_REWRITE_ENABLED=TRUE;

 

ALTER INDEX i_name RENAME TO i_name;

 

Bitmap Index

Good Candidate for Bitmap Index is a column that is referenced in many queries, but it contains only a small range of values;

If the number of distinct values of a column is less than 1 percent of the number of rows in the table, or if the values in a column are repeated more than 100 times, then the column is a candidate for a bitmap index.

 

CREATE BITMAP INDEX i_name ON tab_name(col_name);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章