If you notice poor performance in your Oracle database, two causes might be
row chaining and
We can prevent some of them by properly designing and diagnosing the database.
1) Row Migration and 2) Row Chaining are two potential problems that can be prevented. By suitably diagnosing, we can improve database performance. The main considerations are:
What is Row Migration & Row Chaining ?
How to identify Row Migration & Row Chaining ?
How to avoid Row Migration & Row Chaining ?
Migrated rows affect OLTP systems which use indexed reads to read singleton rows. In the worst case, you can add an extra I/O to all reads which would be really bad. Truly chained rows affect index reads and full table scans.
An update or insert always increases row length. The table below describes row migration and chaining.
Table Fetch by Continued Row
You can detect migrated or chained rows by checking the number of table fetch continued row statistic in V$SYSSTAT.
A small number of chained rows (less than 1%) is unlikely to impact system performance. However, a large percentage of chained rows can affect performance. Chaining on rows larger than the block size is inevitable.
You might want to consider using tablespace with larger block size for such data. However, for smaller rows, you can avoid chaining by using sensible space parameters and good application design. For example, do not insert a row with key values filled in and nulls in most other columns, then update that row with the real data, causing the row to grow in size. Rather, insert rows filled with data from the start.
If an UPDATE statement increases the amount of data in a row so that the row no longer fits in its data block, then Oracle tries to find another block with enough free space to hold the entire row.
Migrating a Row
If such a block is available, then Oracle moves the entire row to the new block. This is called migrating a row. If the row is too large to fit into any available block, then Oracle splits the row into multiple pieces and
stores each piece in a separate block. This is called chaining a row. Rows can also be chained when they are inserted.Migration and chaining are especially detrimental to performance with the following:
UPDATE statements that cause migration and chaining to perform poorly
Queries that select migrated or chained rows because these must perform additional input and output
Sample Output Table
The definition of a sample output table named CHAINED_ROWS appears in a SQL script available on your distribution medium. The common name of this script is UTLCHN1.SQL, although its exact name and location varies depending on your platform.
Your output table must have the same column names, datatypes, and sizes as the CHAINED_ROWS table.Increasing PCTFREE can help to avoid migrated rows. If you leave more free space available in the block, then the row has room to grow. You can also reorganize or re-create tables and indexes that have high deletion rates.
If tables frequently have rows deleted, then data blocks can have partially free space in them. If rows are inserted and later expanded, then the inserted rows might land in blocks with deleted rows but still not have enough room to expand.
Reorganizing the table ensures that the main free space is totally empty blocks.