关于block buffer的问题

[复制链接]
查看11 | 回复6 | 2005-12-27 14:11:11 | 显示全部楼层 |阅读模式
'The LRU Algorithm and Full Table Scans
When the user process is performing a full table scan, it reads the blocks of the table
into buffers and puts them on the LRU end (instead of the MRU end) of the LRU
list. This is because a fully scanned table usually is needed only briefly, so the blocks
should be moved out quickly to leave more frequently used blocks in the cache.
You can control this default behavior of blocks involved in table scans on a
table-by-table basis. To specify that blocks of the table are to be placed at the MRU
end of the list during a full table scan, use the CACHE clause when creating or
altering a table or cluster. You can specify this behavior for small lookup tables or
large static historical tables to avoid I/O on subsequent accesses of the table.'

--from concept
上面的文档意思是说:对该表作FTS时,cache选项指定表是写入LRU LIST的MRU的一端。
如果想把表装入到内存中,其实是这样一个过程:
1. alter table test storage(buffer_pool keep);(执行完后内存中并没有表的数据)
2. 当查询test表时,查询到的数据块才会保存在keep pool中,如果是FTS,那么所有的数据就都保存在内存中了。
不知道我的理解对不对?
另外,alter table test nocache storage(buffer_pool keep);
执行了这个,查询的时候还会同时放入内存中一份么?
怎么测试一下?
回复

使用道具 举报

千问 | 2005-12-27 14:11:11 | 显示全部楼层
尽管放在keep中,如果是fts,也会放末端,这种对fts的块处理方法不应该随pool的变化改变,测试应该简单,建立一个keep,再建立几个在keep里的索引,然后建立一个不大于keep总体大小的表,不小于keep20%的表,select /*+ full*/ 看有没有physical read
回复

使用道具 举报

千问 | 2005-12-27 14:11:11 | 显示全部楼层
那就是说不管cache=y还是n,对于FTS来说,影响是存入LRU的哪一端;那么对于非FTS呢?
'CACHE VARCHAR2(5) Whether the cluster is to be cached in the buffer cache
(CACHE | NOCACHE)'
-- 9iR2 Reference ALL_TABLE
对于上面这个怎么解释呢?
回复

使用道具 举报

千问 | 2005-12-27 14:11:11 | 显示全部楼层
cache是cache和指定pool不是一回事
回复

使用道具 举报

千问 | 2005-12-27 14:11:11 | 显示全部楼层
恩,是,这个我知道。
但是cache选项到底应该怎么理解:
如果选定nocache,那么查询的时候就不会再内存中存一份?还是说是放入内存,但是决定放到LRU的哪一端?
回复

使用道具 举报

千问 | 2005-12-27 14:11:11 | 显示全部楼层
storage指定放哪个pool,cache nocache指定放在这个pool的hot还是cool,不放内存里是直读
回复

使用道具 举报

千问 | 2005-12-27 14:11:11 | 显示全部楼层
恩恩,搞清楚了,呵呵

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行