oracle sql优化之多表连接优化
Use equality first.
使用等连接
Use range operators only where equality does not apply.
只有在等连接不可用的情况下事由区间连接
Avoid use of negatives in the form of !=
or NOT.
避免使用 != 或者 not
Avoid LIKE pattern matching.
避免使用 LIKE匹配
Try to retrieve specific rows and in small numbers.
尝试查找特殊的列和在小的数目中
Filter from large tables first to reduce rows joined.
Retrieve tables in order from the most highly filtered table downwards;
preferably the largest table has the most filtering applied.
过滤大表减少连接的行数,从过滤多的表向下查找,尽可能的过滤大表
Tip
The most highly filtered table is the table having the
smallest percentage of its rows retrieved, preferably the largest
table.
Use indexes wherever possible except for very small
tables.
除非很小的表,无论什么情况多有索引
Let the Optimizer do its job.
让优化器做优化
相关文档:
ORACLE里锁有以下几种模式:
0:none
1:null 空
2:Row-S 行共享(RS):共享表锁,sub share
3:Row-X 行独占(RX):用于行的修改,sub exclusive
4:Share 共享锁(S):阻止其他DML操作,share
5:S/Row-X 共享行独占(SRX):阻止其他事务操作,share/sub exclusive
6:exclusive 独占(X):独立访问使用,exclusive
......
1. 查询数据库现在的表空间
select tablespace_name, file_name, sum(bytes)/1024/1024 table_size from dba_data_files group by tablespace_name,file_name;
2. 建立表空间
CREATE TABLESPACE data01 DATAFILE '/oracle/ ......
Oracle 三种集合数据类型的比较:
PL/SQL中没有数组的概念,他的集合数据类型和数组是相似的。在7.3以前的版本中只有一种集合,称为PL/SQL表,在这之后又有两种集合数据类型:嵌套表和varray。其中varray集合中的元素是有数量限制的,index_by表和嵌套表是没有这个限制的。index-by表是稀疏的,也就是说下标可以不连续 ......
1)建立操作系统目录e:\test,准备数据文件dept.txt并置于e:\test之下
"10","ACCOUNTING","NEW
YORK"
"20","RESEARCH","DALLAS"
"30","SALES","CHICAGO"
"40","OPERATIONS","BOSTON"
2)创 ......