| |
 |
|
Real World applications for read-only tablespaces
Oracle Tips by Burleson Consulting |
The Data Warehouse Development Life Cycle
Oracle Features for the Data Warehouse
Read-only tablespaces in the real world
But how do we “pack” Oracle data for use as a read-only tablespace?
Essentially, there are two areas where space is wasted within an
Oracle table. On each data block, Oracle will reserve an amount for
row expansion and this value is controlled by the PCTFREE table
parameter. The PCTFREE parameter is useful when we are loading
incomplete rows that have columns that are defined with VARCHAR data
definitions. After initial loading, Oracle reserves space at the end
of each data block for row expansion. For example, if we have
defined the fact_96 table with 8K blocks and PCTFREE = 25, we have
reserved 2000 bytes at the end of each and every data block for row
expansion. Later when is issue an SQL UPDATE command to add column
values for a null value, the row size will expand into this free
space. The second area of free space in a tablespace is the space
left over that the end of the table. (figure 8.15) Here we might see
that the fact_96 table consumes only 75% of its tablespace, allowing
for the table to extend as new rows are added. In short, table grow
wider as column values are added (in each data block), and table
grow longer as rows are added (at the end of the tablespace).
Figure 8.15 Free space distribution within a tablespace
If we know that the table chunk is now static, we can export the
table into a flat file, and re-define the table and tablespace
characteristics to maximize the amount of occupied space. At the
table level, we set PCTFREE equal to 0, not reserving any space
within the data blocks for growth. At the tablespace level, we
redefine the tablespace to consume only as much space as the table
requires. (The total amount of space for a table can be estimated
fairly accurately by estimating the average row length, and
multiplying by the number of rows)
This is an excerpt from "High Performance
Data Warehousing", copyright 1997.
 |
If you
like Oracle tuning, you may enjoy the book
Oracle Tuning: The Definitive Reference , with
over 900 pages of BC's favorite tuning tips &
scripts.
You can buy it
directly from the publisher and save 30%, and get
instant access to the code depot of Oracle tuning
scripts. |
|