现在的位置: 首页 > 综合 > 正文

行链接和行迁移检测和消除方法

2014年08月01日 ⁄ 综合 ⁄ 共 2897字 ⁄ 字号 评论关闭

     在官方文档中,翻译Performance Tuning Guide /10.2.4.3 Table Fetch by Continued Row.

         You can detect migrated or chained rows by checking the number of tablefetchcontinuedrow 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.

--你可以通过V$SYSSTAT检测到行迁移和行链接.这个链接少(小于1%)是不太可能影响性能.然而,比例占大了就会影响性能。

         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, donot  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.

         --链接行大于block size是不可避免的,对这些数据你可以考虑使用增大block size的表空间。可是,多小的行,你可以用空间参数和好的应用设计避免链接.例如,不要插入一行数据,而一行带有大量NULL的列,更合适的是,从一开始插入数据就要填满行。

        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. 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.

         --如果一个update语句使一行增大而造成数据块不能容纳此行,oracle会找到一个其它块能够容纳整行.如果有这样的空闲块,oracle会移动整行到新的块中,这个叫行迁移。如果行太大以至于不能插入任何块,于是oracle会把这行分裂成不同的片段存储到不同的数据块上,这个叫行链接,这个情况发生在insert.

       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

         The definition of a sample output table namedCHAINED_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.

      --以下是特别对性能有害的行链接和行迁移:

        Update语句引起的行迁移导致性能不佳;对查询行迁移和行链接的行必须执行额外的输出、输入.检测行链接:

        SQL> @?\RDBMS\ADMIN\utlchain.sql

        SQL> analyze table table_name list chained rows into chained_rows;

        SQL> select owner_name,table_name,head_rowid from chained_rows;

        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.

--增大pctfree可以帮组避免行迁移.如果你在块中预留更多空余空间,因而行有更多的空间增长.你也可以重建表和删除率高的索引.如果表频繁的有行删除,那么数据块能够有部分的空余空间.如果行插入然后扩大,插入的行占用删除行的空间但是依然没有足够的空间去扩展.重新组织表确保主要的空余空间是空块.

 

抱歉!评论已关闭.