数据库生态圈(RDB & NoSQL & Bigdata)——专注于关系库优化(Oracle & Mysql & Postgresql & SQL Server )

https://www.cnblogs.com/lhdz_bj
http://blog.itpub.net/8484829
https://blog.csdn.net/tuning_optmization
https://www.zhihu.com/people/lhdz_bj

导航

keep buffer pool的实验及使用

--下面是对keep pool使用的实验及总结:

alter system set db_keep_cache_size=100m scope=both;
create table test(c1 int,c2 char(2000),c3 char(2000),c4 char(2000),c5 char(1000)) storage(buffer_pool keep)cache;
insert into test values(1,'a','b','c','d');
insert into test select * from test;    --重复多次
analyze table test compute statistics for table for all columns;
或exec dbms_stats.gather_table_stats(user,'X1',cascade=>true);
select distinct c2,c3,c4,c5 from test;


注:
1.要想使对象真的保持在内存中,一定要让db_keep_cache_size的值大于系统中所有buffer_pool为keep的所有对象的空间之和,而且还要略大于这个空间之和,至于大多少,我不是很确定,本人只是片面的进行了简单的测试,一个194M的表,需要大约240m的空间,一个66M的表,需要85M的空间,具体情况,还需要具体测试;
2.表进行dml操作后,一定要先进行analyze或dbms_stats.gather_table_stats(),也就是生成最新的统计信息,如果差别很大,那么也不能保证表在内存中;
3.在我的实验里,一旦表被强行刷出内存或者因keep pool不足而被挤出内存或者数据库重新启动,即使db_keep_cache_size空间足够大,其他数据库对象属性的修改、分析及数据库的重启,都不能让该对象重新回到内存,必须对该表进行再次分析,才能使该表重新回到内存;
4.刚才看到资料,忽然想起了keep buffer中对象的undo信息也是存储在keep pool中的,因此,第一点中keep buffer要比需要keep在keep pool中的对象所需空间之和稍大的原因,从这里找到了答案;

posted on 2011-03-15 11:32  lhdz_bj  阅读(1313)  评论(0编辑  收藏  举报