lasted updated 2005-03-30
key word : unique index/rebuild index
2005-03-29
key word : shared pool/sort_area_size/sga/sqlplus arraysize
0.WNPS和RNPS
"Write no Package State" (WNPS)
"Read no Package State" (RNPS)
1.关于shared pool : 共享池越大,就越难以管理和换页?
(The larger the shared pool, the harder to manage and page the stuff in and out.)
tom认为100m的shared pool已经不小了.
解决跟share pool有关的终极之道是优化应用,使用Binds.
2.sqlplus中的arraysize会影响统计信息中的
假定一张表(a table with packed blocks.),存储数据的每个block有45行记录,有两个blocks.
sqlplus的默认arraysize为15.
第一次:读取第一个block提取第一个15行数据
第二次:读取第一个block提取下一个15行数据
第三次:读取第一个block提取下一个15行数据
第四次:读取第一个block判断是否还有数据,然后读取第二个block
依此类推,读取2个blocks,需要8次lios(LIO's -- logical io's, which are buffer reads which
might be consistent gets or current mode gets).
测试数据:
create table t ( x int ) tablespace manual;
insert into t select rownum from all_objects where rownum <=45;
alter table t minimize records_per_block;
insert into t select rownum from all_objects where rownum <=45;
commit;
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:6749454952894
3.在需要执行大批量排序的批处理会话中增大sort_area_size值可以很大的提升排序性能.
sort_area_size 越小,临时表空间的使用就越大,操作的执行时间就越长.
People tend to way undersize this and never change at the session level for
batch jobs. It can make a TREMENDOUSLY huge difference though!
4.关于SELECT * FROM v$sga;结果的解析
NAME VALUE
-------------------- ---------
Fixed Size 39816
Variable Size 151544820
Database Buffers 838860800
Redo Buffers 41943040
Fixed Size的大小由oracle控制,可以把这部分认为是SGA的“bootstrap”,
用于获取SGA其他部分的bits和pieces的信息.
compute sum of bytes on pool
break on pool skip 1
select pool, name, bytes
from v$sgastat
order by pool, name;
Variable Size的大小大致等于ava_pool_size + large_pool_size + shared_pool_size
要注意每个控制文件会占用256个字节的variable size,如果数据库有4个控制文件,那么
SGA中有1024个bytes分配给这些控制文件.
The variable size is MOST affected by
5.关于唯一性约束中的索引
在建立约束的时候,
如果约束列上有索引(包括前导列为约束列的复合索引),使用该索引
如果没有索引并且约束非deferrable,创建唯一索引
如果没有索引并且约束deferrable,创建非唯一索引
6.什么时候rebuild index
a)找到出现性能问题的根源
b)调整之.
如果b)需要rebuild index那么rebuild之.无需定期rebuild index.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/6906/viewspace-21751/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/6906/viewspace-21751/