 |
|
 |
Donald K. Burleson
Oracle Tips |
New Oracle Data buffer Cache
In Oracle9i and above, you can create tablespaces with blocksizes that
differ from the overall database blocksize. If you choose to do this, then
you must also enable one or more of the new db_nk_cache_size parameters,
so that blocks read in from tablespaces that have a different blocksize
than the regular database blocksize have a cache to reside.
For example, if you create a tablespace with a 16K blocksize, then you
must also set aside RAM for those blocks using the db_16k_cache_size
parameter. Note that such allocations are in addition to the memory
allotments specified by the db_cache_size parameter.
This feature allows you to tune your database in ways that were impossible
in earlier versions of Oracle. For example, you can use the large (16-32K)
blocksize data caches to store data from indexes or tables that are the
object of repeated large scans. Does such a thing really help performance?
A small but revealing test can answer that question.
For the test, the following query will be used against a 9i database that
has a database block size of 8K, but also has the 16K cache enabled along
with a 16K tablespace:
select
count(*)
from
eradmin.admission
where
patient_id between 1 and 40000;
The ERADMIN.ADMISSION table has 150,000 rows in it and has an index build
on the PATIENT_ID column. An EXPLAIN of the query reveals that it uses an
index range scan to produce the desired end result:
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 (Cost=41 Card=1 Bytes=4)
1 0 SORT (AGGREGATE)
2 1 INDEX (FAST FULL SCAN) OF 'ADMISSION_PATIENT_ID'
(NON-UNIQUE) (Cost=41 Card=120002 Bytes=480008)
Executing the query (twice to eliminate parse activity and to cache any
data) with the index residing in a standard 8K tablespace produces these
runtime statistics:
Statistics
---------------------------------------------------
0 recursive calls
0 db block gets
421 consistent gets
0 physical reads
0 redo size
371 bytes sent via SQL*Net to client
430 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
To test the effectiveness of the new 16K cache and 16K tablespace, the
index used by the query will be rebuilt into the larger tablespace, while
everything else remains the same:
alter index
eradmin.admission_patient_id
rebuild nologging noreverse tablespace indx_16k;
Once the index is nestled firmly into the 16K tablespace, the query is
re-executed (again, twice) with the following runtime statistics being
produced:
Statistics
---------------------------------------------------
0 recursive calls
0 db block gets
211 consistent gets
0 physical reads
0 redo size
371 bytes sent via SQL*Net to client
430 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
As you can see, the amount of logical reads has been cut in half simply by
using the new 16K tablespace and accompanying 16K data cache. Clearly, the
benefits of the proper use of the new data caches and multi-block
tablespace features of Oracle9i are worth investigating and testing in
your own database.
The above is an excerpt from
Oracle Performance Troubleshooting by Robin
Schumacher.
It's only $19.95 and you can order it
and get instant access to the Oracle scripts here:
http://www.rampant-books.com/book_2003_1_perf.htm

|
|