Download Tuning Table and Index

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft SQL Server wikipedia , lookup

SQL wikipedia , lookup

Concurrency control wikipedia , lookup

Registry of World Record Size Shells wikipedia , lookup

Clusterpoint wikipedia , lookup

PL/SQL wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Oracle Database wikipedia , lookup

Ingres (database) wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Relational model wikipedia , lookup

Join (SQL) wikipedia , lookup

Database model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Transcript
Tables
Tables are the basic units of data storage in an Oracle database, so their configuration and
resulting performance will have a large impact on overall database performance. Some
guidelines for table configuration are as follows:









Try to estimate how big a table will be and allocate a sufficiently large INITIAL
extent to hold the entire table. However, if you are using Parallel Query, allocate
the total space across as many extents in different datafiles as the degree of
parallelism for the table.
Consider using multiple tablespaces for tables, each for a different size or type of
table. For example, you might have three tablespaces: LARGE_DATA,
MEDIUM_DATA, and SMALL_DATA, each of which would be used to hold
tables of a particular size. If you are using multiple tablespaces for tables, be sure
to allocate each table in the appropriate tablespace.
Be sure to assign a DEFAULT TABLESPACE to each user. If one is not
assigned, Oracle will use the SYSTEM tablespace by default.
If possible, always allocate INITIAL and NEXT extents in multiples of the same
size units; for example, allocate in multiples of 512K. This way, extents will be of
uniform size and it will be easier to allocate additional extents without
fragmenting the tablespace. Where possible, consider making all extents in a
tablespace the same size.
Set the PCTINCREASE parameter to 0, in order to prevent runaway extent
allocation and to preserve uniform extent sizes.
Set MAXEXTENTS to UNLIMITED. This will prevent running out of extents,
since multiple extents have little performance impact in and of themselves
(although widely scattered extents can negatively affect performance). Do this to
prevent errors, but do not use it as a substitute for proper INITIAL sizing.
Set PCTFREE to 0 if no updates will be performed on the table. If updates will be
performed, try to estimate the degree to which columns of a row will grow, and
allocate a PCTFREE that will prevent block chaining without excessive unused
space in the block.
Set INITRANS to a value greater than 1 (the default) if multiple transactions will
access the table simultaneously.
Set MAXTRANS to the maximum number of simultaneous accesses expected on
the table. A lower value will result in one or more transactions waiting for a prior
transaction to complete.
Indexes
Perhaps no other single feature of Oracle can provide as much performance improvement
as the proper use of indexes. While many performance gains will result from tuning SQL
statements (see Chapter 8, Query Optimization), there are also several configuration
guidelines we suggest you follow:





Create a separate tablespace for indexes, and make certain that the datafiles for
this index tablespace are not on the same disk device as any datafiles for
tablespaces that contain indexed tables.
Try to estimate the size of an index and allocate a sufficient INITIAL extent to
hold the entire index, unless you are using Parallel Query, in which case you
should allocate the total space across as many datafiles as the degree of
parallelism for the index.
If possible, always allocate INITIAL and NEXT extents in multiples of the same
size units; for example, allocate in multiples of 512K. This way, extents will be of
uniform size and it will be easier to allocate additional extents without
fragmenting the tablespace.
Set PCTINCREASE to 0 in order to prevent runaway extent allocation and to
preserve uniform extent sizes.
Set MAXEXTENTS to UNLIMITED. This guideline will prevent your running
out of extents, since multiple extents have little performance impact in and of
themselves (although widely scattered extents can negatively affect performance).
Do this to prevent errors, but do not use it as a substitute for proper INITIAL
sizing.