Row Chaining and Row Migration
Row Chaining and Row Migration
Row Chaining
Normally we encounter row chaining when the size of a database row is
larger than the size of the database block that is used for storing it. In this
situation, the row is split across more than one database block. When you
need to access this row, the system access more than one database block,
which results in more I/O operations.
Let’s go ahead with a scenario and assume that default block size in 8kb
Analyze the table to refresh the statistics with the following command
Check for chained rows with the following command
Now create a tablespace with a different block size with the following
command
Analyze the table to refresh the statistics with the following command
Row Migration
We will migrate a row when an update to that row would cause it to not fit on
the block anymore (with all of the other data that exists currently). A
migration means that the entire row will move and we just leave behind the
forwarding address. So, the original block just has the rowid of the new block
and the entire row is moved.
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
The ALTER TABLE … MOVE statement enables you to relocate data of a
non partitioned table or of a partition of a partitioned table into a new
segment, and optionally into a different tablespace for which you have
quota
Rebuild the Indexes for the Table
Conclusion
Row migration is typically caused by UPDATE operation
Row chaining is typically caused by INSERT operation.
SQL statements which are creating/querying these chained/migrated
rows will degrade the performance due to more I/O work.
To diagnose chained/migrated rows use ANALYZE command , query
V$SYSSTAT view
To remove chained/migrated rows use higher PCTFREE using ALTER
TABLE MOVE