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 执行更加像在一个内存数据库里在, 在不牺 ...
随机推荐
- 怎么使用 Laravel 的服务容器来优化读写数据库中的 options关键词
其中我们可以最方便地利用的一个特性就是 Laravel 的服务容器了.在这里我不多赘述 Service Container 是个啥,想了解的可以自行搜索.不想了解的就只要大致知道它是个可以 绑定/取出 ...
- Python包管理工具介绍
常见的包管理工具及关系 setuptools -->distribute easy_install-->pip 1.distribute distribute是对标准库disutils模块 ...
- Android关机闹钟实现
Android关机闹钟实现 时间转换网站:http://tool.chinaz.com/Tools/unixtime.aspx 1.apk层 这个还是比较简单的,百度一下就可以看到apk的代码,我之前 ...
- sql语句返回主键SCOPE_IDENTITY()
在sql语句后使用 SCOPE_IDENTITY() 当然您也可以使用 SELECT @@IDENTITY 但是使用 SELECT @@IDENTITY是去全局最新. 有可能取得值不正确. 示例:in ...
- 如何在 Eclipse 中连接源码
1:首先在window 中 打开首选项(preferences) 找到如下java -- 已安装的JRE
- 关于Filter的配置
配置代码: <filter> <display-name>OneFilter</display-name> <filter-name>OneFilte ...
- JS实现base64编码与解码
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ...
- Android多分辨率适配
前一阶段开发android项目,由于客户要求进行多分辨率适配,能够支持国内主流的分辨率手机.因此经过了几次开发走了很多弯路,目前刚刚领略了android多分辨率适配的一些方法. 先介绍一下所走的弯路, ...
- VC++ 利用MAPI实现在程序中调用默认的电子邮件程序发送EMAIL(可以添加附件)。
1.利用ShellExecute 可以条用默认邮件客户端,但不能发送带附件的邮件 mailto:用户账号@邮件服务器地址?subject=邮件主题&body=邮件正文 如:ShellExe ...
- block 实现原理详解(一)
对于大多数人来讲,block内部到底是怎样实现的呢?我们可以借助clang将其编译成为c++的代码,就可以看出,block到底是什么东西, 先来看这样一个问题, <!-- lang: cpp - ...