14 Using Indexes and Clusters
do not build indexes unless necessary. 索引是非常占资源的
To maintain optimal performance, drop indexes that an application is not using. 不用的索引可以drop掉, 通过toad可以生成监控脚本, 监控一段时间内, 哪些脚本没有被使用 (ALTER INDEX MONITORING USAGE)
什么时候创建索引
Consider indexing keys that appear frequently in WHERE clauses.
Consider indexing keys that frequently join tables in SQL statements. For more information on optimizing joins.
Choose index keys that have high selectivity. The selectivity of an index is the percentage of rows in a table having the same value for the indexed key. An index's selectivity is optimal if few rows have the same value.'
当然, 如果你的索引列上的值, 99%都一样, 那么恐怕就没有必要在这个列上建立索引了.
Do not use standard B-tree indexes on keys or expressions with few distinct values.
Do not index frequently modified columns.
Do not index keys that appear only in WHERE clauses with functions or operators.
要给外键建立索引 (大师有提过)
When choosing to index a key, consider whether the performance gain for queries is worth the performance loss for INSERTs, UPDATEs, and DELETEs and the use of the space required to store the index.
组合索引
CREATE INDEX comp_ind ON table1(x, y, z);
那么, 可以走索引的方式是: x, xy, and xyz combinations of columns are leading portions of the index
你想避免使用索引时: 比如, 你知道 full table scan 效率更高时:
Use the NO_INDEX hint to give the query optimizer maximum flexibility while disallowing the use of a certain index.
Use the FULL hint to instruct the optimizer to choose a full table scan instead of an index scan.
Use the INDEX or INDEX_COMBINE hints to instruct the optimizer to use one index or a set of listed indexes instead of another.
重建索引
Usually, ALTER INDEX ... REBUILD is faster than dropping and re-creating an index,
Function 索引
CREATE INDEX uppercase_idx ON employees (UPPER(last_name));
SELECT * FROM employees WHERE UPPER(last_name) = 'MARKSON';
Partitioned Indexes
类似 partitioned table
Oracle Database supports both range and hash partitioned global indexes. In a range partitioned global index, each index partition contains values defined by a partition bound.
In a hash partitioned global index, each partition contains values determined by the Oracle Database hash function.
14 Using Indexes and Clusters的更多相关文章
- PLSQL_性能优化系列08_Oracle Insert / Direct Insert性能优化
2014-09-25 Created By BaoXinjian
- 訪问远程WAMP 下phpmyadmin
WAMP环境是一个非常优秀的webservice集成环境,它集成的phpmyadmin也是一款非常优秀的数据库訪问软件.wamp默认安装下,phpmyadmin工具仅仅能本地用,在站点开发中,数据库都 ...
- Oracle组成介绍
Oracle Database 11g是一些特殊文件的集合,这些文件是用数据库配置助手创建的,然后用OEM Grid Control完成相关工作.这些数据库文件是通过一组共享内存进程来进行访问的,这组 ...
- oracle之表空间(tablespace)、方案(schema)、段(segment)、区(extent)、块(block)
数据文件和日志文件是数据库中最关键的文件.它们是数据存储的地方.每一个数据库至少有一个与之相关的数据文件,通常情况下不仅仅一个,有非常多.数据在数据文件里是怎样组织的?要了解这些内容我们首先必须理解什 ...
- schema in oracle
the conception of schema is different in different db software. here i just refer to oracle schema. ...
- 关于在windows server 2008 上部署wampserver2.5部署的问题
1.关闭windows自带防火墙 2.httpd.conf文件权限 apache 2.4.9 外网访问的问题参考此文: http://blog.csdn.net/lysc_forever/articl ...
- [Java]数据分析--聚类
距离度量 需求:计算两点间的欧几里得距离.曼哈顿距离.切比雪夫距离.堪培拉距离 实现:利用commons.math3库相应函数 1 import org.apache.commons.math3.ml ...
- 14.8.9 Clustered and Secondary Indexes
14.8.9 Clustered and Secondary Indexes 每个InnoDB 表有一个特殊的索引称为 clustered index 用于存储数据. 通常, clustered in ...
- 14.2.5.6 Adaptive Hash Indexes 自适应Hash Indexes
14.2.5.6 Adaptive Hash Indexes 自适应Hash Indexes adaptive hash index(AHI) 让InnoDB 执行更加像在一个内存数据库里在, 在不牺 ...
随机推荐
- HDU 3652:B-number(数位DP)
http://acm.hdu.edu.cn/showproblem.php?pid=3652 题意:求数位含有13和可以被13整除的数字个数. 思路:记录3种状态: st == 0 表示 从最高位到第 ...
- data-属性
html5中出现data标签,该标签可以为div,p,span,td等各种标签提供属性 <div id="button" data-mm='{"name" ...
- YTU 3020: 对称矩阵(数组)
3020: 对称矩阵(数组) 时间限制: 1 Sec 内存限制: 128 MB 提交: 3 解决: 2 题目描述 已知A和B为两个n*n阶的对称矩阵,输入时,对称矩阵只输入下三角行元素,存入一维数 ...
- 错误Mybatis 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminat
今天算是见识了什么事顺序的重要性. 在使用mybatis时由于联合了其他的表,用到了resultMap,之后外加association这一项.可是在替换对应字段的位置上加上association总是报 ...
- Python3发送post请求,自动记住cookie
转载自:http://www.cnblogs.com/meitian/p/4607737.html 在做登录的post请求时,需要记住cookie,否则不能访问登录后的页面. 下面是登录的代码: #c ...
- win10 + VS2015 + EF6 + MySQL
前置配置 在下面的网址去安装最新版的 (Connector/Net http://dev.mysql.com/downloads/connector/net/#downloads) 然后安装 MySQ ...
- js九九乘法表
<!doctype html><html><head><meta charset="utf-8"><title>无标题文 ...
- JAVA学习随笔-.class
类名.class是获得这个类所对应的Class实例.从面向对象的角度上来看,类也是对象,它们是类这个类对象,听起来有些抽象,但是在java中的实现就是所有的加载进来的类在虚拟机中都是一个java.la ...
- java web简单权限管理设计
一套最基本的权限管理包括用户.角色.资源. 数据库设计 我的设计如下: 用户:user 角色:role 用户-角色:user_role 资源:resource(包括上级菜单.子菜单.按钮等资源) 角色 ...
- HTML 的 <div> 和 <span> 标签
这篇文章里会涉及到两个术语,这里先明确一下: 块级元素,block level element 内联元素(或者叫行内元素),inline element 大多数 HTML 元素被定义为块级元素和内联元 ...