Oracle索引index
来源:互联网 发布:java中什么叫多态 编辑:程序博客网 时间:2024/06/07 06:55
--索引
/*有一条基本的创建索引原则是:当任何单个查询要检索的行少于或等于整个表行数的10%.*/
--创建索引
/*create [ unique] index index_name on
table_name (column_name[,column_name ...])
tablespace tab_space;
其中unique指定索引列中的值必须是唯一的
colunm_name指定要对哪个列创建索引。如果对多列创建索引,这种索引称为复合索引
tab_space指定存储该索引的表空间.如果没有指定,那么索引被存储到用户默认的表空间中。
由于性能方面的原因,通常将表与索引存储在不同的表空间中。
*/
--在创建索引时应该遵循一些原则,假设customers表包含很多行,并且通常使用一个包含where子句的select语句对customers表进行检索,其中where子句对last_name列
--进行过滤;例如:
select *
from t_customers
where last_name='Brown';
--假设last_name列的值都是唯一的,以使任何where子句中使用last_name列的查询所返回的行数都小于表总行数的10%。因此,last_name列非常适合创建索引
create index idx_customers_last_name on t_customers(last_name);
--创建基于函数的索引
--假设执行下列这个查询
select *
from t_customers
where last_name=upper('PRICE');
--由于查询使用了一个函数UPPER(),因此就不会使用索引idx_customers_last_name,如果想让索引可以基于函数的结果使用,必须创建基于函数的索引.
create index idx_func_customers_last_name on t_customers(UPPER(last_name));
--另外,为了利用基于函数的索引,DBA必须把初始化参数QUERY_REWRITE_ENABLED设置为true(默认值为false)
conn system/tiger
alter system set QUERY_REWRITE_ENABLED=TRUE;
- Oracle索引index
- Oracle索引index
- oracle 索引(index)
- oracle index 索引总结
- oracle 索引(index)
- Oracle - index (索引)
- oracle index(索引)
- Oracle索引(index)
- Oracle-index索引解读
- Oracle 索引 index
- oracle索引index
- Oracle笔记 之 索引(index)
- Oracle笔记 之 索引(index)
- Oracle 索引监控(monitor index)
- Oracle 虚拟索引(Virtual index)
- oracle 索引index那些事
- oracle 索引(Bitmap Index)
- Oracle索引监控(monitor index)
- div显示滚动条的css代码
- Hibernate、Spring和Struts工作原理及使用理由
- 就从今天我要开始在CSDN上做学习笔记了
- NOR FLASH 修改 在AT91RM9200上
- iBATIS教程之入门浅析
- Oracle索引index
- FLASH遮挡DIV解决方案,兼容IE FF Chrome
- acle用户管理
- 1006 一卡通大冒险
- 1007 青蛙过河
- 六方面助你成为职业程序员
- 基于TI Davinci架构的双核嵌入式应用处理器OMAPL138开发入门
- spring-security3.*幾點體會
- 1009 美好的一天