Chapter 11-Creating Other Schema Objects ---Index
2013-04-11 19:06
405 查看
Indexes是可选项,可有可无;它存在的价值就是improves the performance of some queries.
Can reduce disk input/output(I/O) by using a rapid path access method to locate data quickly
Is independent of the table that it indexes
Is used and maintained automatically by the Oracle server.
|-Auto
|-Manu Automatically:
A unique index is created automatically when you define a PRIMARY KEY or UNIQUE constraint in a table definition.
Manually:Users can create nonunique indexes on columns to speed up access to the rows.
|-nonunique index
Improve the speed of query access to the LAST_NAME column in the EMPLOYEES table:
A column contains a large number of null values One or more columns are frequently used togerther in a WHERE cluase or join condition
The table is large and most queries are expected to retrieve less than 2% to 4% the rows in the table
The table is small or most queries are expected to retrieve more than 2% to 4% of the rows in the table
The table is updated frequently
The indexed columns are referenced as part of an expression.
Remove the emp_last_name_idx index from the data dictionary DROP INDEX EMP_LAST_NAME_IDX;
To drop an index,you must be the owner of the index or have the DROP ANY INDEX privilege.
An index:
Is a schema object Can be used by the Oracle server to speed up the retrieval of rows by using a pointerCan reduce disk input/output(I/O) by using a rapid path access method to locate data quickly
Is independent of the table that it indexes
Is used and maintained automatically by the Oracle server.
How are indexes created ?
two methods:|-Auto
|-Manu Automatically:
A unique index is created automatically when you define a PRIMARY KEY or UNIQUE constraint in a table definition.
Manually:Users can create nonunique indexes on columns to speed up access to the rows.
Index category
|-unique index|-nonunique index
Creating an index
Create an index on one or more columns:CREATE [UNIQUE] [BITMAP] INDEX index ON table (column,[,column]...);
Improve the speed of query access to the LAST_NAME column in the EMPLOYEES table:
CREATE INDEX emp_last_name_idx ON employees(last_name);
Index creation guidelines
Create an index when:
A column contains a wide range of valuesA column contains a large number of null values One or more columns are frequently used togerther in a WHERE cluase or join condition
The table is large and most queries are expected to retrieve less than 2% to 4% the rows in the table
Do not create an index when:
The column are not often used as a condition in the queryThe table is small or most queries are expected to retrieve more than 2% to 4% of the rows in the table
The table is updated frequently
The indexed columns are referenced as part of an expression.
Removing an index
Remove an index from the data dictionary by using the DROP INDEX command: DROP INDEX indexRemove the emp_last_name_idx index from the data dictionary DROP INDEX EMP_LAST_NAME_IDX;
To drop an index,you must be the owner of the index or have the DROP ANY INDEX privilege.
相关文章推荐
- Chapter 11-Creating Other Schema Objects ---Sequence
- Chapter 11-Creating Other Schema Objects ---Synonym
- Chapter 11-Creating Other Schema Objects ---View
- Imperfect C++:Chapter 11 Statics:11.3Function-Local static objects
- 【Chapter-1】Creating and destorying objects
- Learning C++ by Creating Games With UE4(15.05.20)(Chapter 11-1)Monster
- advanced dom scripting dynamic web design techniques Chapter 2 CREATING YOUR OWN REUSABLE OBJECTS
- Learning C++ by Creating Games With UE4(15.05.21)(Chapter 11-3)Monster
- Data Structures and Other Objects Using C++ (Chapter 1) 学习笔记二
- Learning C++ by Creating Games With UE4(15.05.21)(Chapter 11-4)Monster
- Data Structures and Other Objects Using C++ (Chapter 2) 学习笔记五
- Data Structures and Other Objects Using C++ (Chapter 1) 学习笔记三
- Data Structures and Other Objects Using C++ (Chapter 1) 学习笔记一
- Data Structures and Other Objects Using C++ (Chapter 2) 学习笔记四
- Learning C++ by Creating Games With UE4(15.05.21)(Chapter 11-2)Monster
- 11G Concept 第四章翻译 Partitions, Views, and Other Schema Objects(分区,视图,以及其他Schema Objects)
- Breaking Tight Coupling by using Mock Objects(Chapter 4 of Python Testing Beginner's Guide)
- Chapter 11 Exercises & Problems
- Chapter 11.顺序容器forward_list[c++11]
- Learning C++ by Creating Games With UE4(15.05.11)-4(Chapter 8-2)