技术开发 频道

RECYCLE池的CACHE特点(四)

SQL> SELECT /*+ INDEX(T) */ COUNT(TEXT) FROM T; COUNT(TEXT) ----------- 333442 Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 13896 consistent gets 9857 physical reads 0 redo size 384 bytes sent via SQL*Net to client 503 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed SQL> SELECT OBJECT_NAME, A.STATUS, COUNT(*) 2 FROM V$BH A, USER_OBJECTS B 3 WHERE A.OBJD = B.OBJECT_ID 4 AND OBJECT_NAME IN ('T', 'T2', 'T3', 'IND_T_NAME') 5 GROUP BY OBJECT_NAME, A.STATUS; OBJECT_NAME STATU COUNT(*) ------------------------------ ----- ---------- T xcur 7653 T2 xcur 1 T3 xcur 1 IND_T_NAME xcur 441 SQL> SELECT COUNT(*) FROM T2; COUNT(*) ---------- 167011 Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 4839 consistent gets 4829 physical reads 0 redo size 381 bytes sent via SQL*Net to client 503 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed SQL> SELECT OBJECT_NAME, A.STATUS, COUNT(*) 2 FROM V$BH A, USER_OBJECTS B 3 WHERE A.OBJD = B.OBJECT_ID 4 AND OBJECT_NAME IN ('T', 'T2', 'T3', 'IND_T_NAME') 5 GROUP BY OBJECT_NAME, A.STATUS; OBJECT_NAME STATU COUNT(*) ------------------------------ ----- ---------- T xcur 3101 T2 xcur 4829 T3 xcur 1 IND_T_NAME xcur 165
显然,二者都没有遵守RECYCLE池先进入CACHE的内存不会被替换出去的特点,而是采用了完全替换的策略。

或者,换一种说法更恰当。RECYCLE主要是针对NOCACHE的表,而且RECYCLE池的特点也并不是先放入CACHE的数据不会被替换掉,而是在CACHE满了之后,后面读取的数据根本不会向CACHE中放。这种说法似乎更符合RECYCLE的含义。

而对于CACHE的表和索引扫描,RECYCLE池的策略似乎和KEEP池很接近。看下面的例子,基本上完全符合KEEP池的缓存特点。
SQL> SELECT COUNT(*) FROM T2; COUNT(*) ---------- 167011 Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 4839 consistent gets 0 physical reads 0 redo size 381 bytes sent via SQL*Net to client 503 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed SQL> ALTER TABLE T3 CACHE; Table altered. SQL> SELECT COUNT(*) FROM T3; COUNT(*) ---------- 167011 Statistics ---------------------------------------------------------- 107 recursive calls 0 db block gets 4849 consistent gets 4828 physical reads 0 redo size 381 bytes sent via SQL*Net to client 503 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 2 sorts (memory) 0 sorts (disk) 1 rows processed SQL> SELECT OBJECT_NAME, A.STATUS, COUNT(*) 2 FROM V$BH A, USER_OBJECTS B 3 WHERE A.OBJD = B.OBJECT_ID 4 AND OBJECT_NAME IN ('T', 'T2', 'T3', 'IND_T_NAME') 5 GROUP BY OBJECT_NAME, A.STATUS; OBJECT_NAME STATU COUNT(*) ------------------------------ ----- ---------- T2 xcur 3267 T3 xcur 4829 SQL> SELECT COUNT(*) FROM T3; COUNT(*) ---------- 167011 Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 4839 consistent gets 0 physical reads 0 redo size 381 bytes sent via SQL*Net to client 503 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed SQL> SELECT COUNT(*) FROM T2; COUNT(*) ---------- 167011 Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 4839 consistent gets 4828 physical reads 0 redo size 381 bytes sent via SQL*Net to client 503 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed
0
相关文章