bug 3282805: TRUNCATE TABLE SCANS FOR SMALL TABLES ENTIRE BUFFERCACHE
数据库版本9.2.0.4
PROBLEM:
--------
Truncate table takes on system with large buffercaches to long. It scans the
complete cache to find all blocks which belong to the table.
DIAGNOSTIC ANALYSIS:
--------------------
For small Table we should just scan the DBA Range of the table, as drop table
does.
A segmentis considered large if
1) the size of the segment is greater than half the number of buffers in the
cache
2) It is RAC and number of extents is > 1
3) It is non-RAC and number of extents is > 5
For large segments we issue flush by objd, for smaller ones, we use flush by
range.
oracle建议:
在9.2.0.4之前,建立一个nk block的表空间来存放这些临时表,这样就不需要scan默认的buffer了
This is a recommendation directly from the PS/Oracle 9i tuning guide.
Create the temporary tables on a tablespace that has different Oracle block
size than the rest of the tablespaces. By doing this, the temporary tables will
be placed on a different buffer pool, which will improve truncate time. Having
a separate buffer pool for temporary tables will also reduce RO enqueue
contention when multiple AE jobs are running in parallel and truncating temp
tables.
在9.2.0.4之后,需要满足以下的规则才会走the DBA Range of the table
in 9.2.0.5 and higher, it may also help to make sure a "temp" table
that is frequently truncated have storage defined so that it occupies
one extent. But this workaround is only available as long as the extent
is no more than 50% the size of the buffer cache. In non-RAC environments
the table still has to be smaller than 50% of the buffer cache, but it
allows the table to have up to 5 extents before falling back to the old
algorithm.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/16158219/viewspace-628016/
,如需转载,请注明出处,否则将追究法律责任。