database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
ㆍOracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Oracle Q&A 26675 게시물 읽기
No. 26675
chained rows 가 뭘 의미 하는 건지요 ?
작성자
까먹지마(까먹지마)
작성일
2006-05-08 10:55
조회수
3,109

오라클 튜닝 자료를 보다보니... 다음과 같은 것이 있거든요.

===============================================================

Disk I/O(chain or migration table 검색)

.$ORACLE_HOME/rdbms/admin/utlchain.sql
.analyze table account list chained rows;
.chain 발생 row 확인
select *
from chained_rows
where table_name = 'ACCOUNT';
.chain 발생 row 수정 : 부록A(1,2) 참조

analyze table account list chained rows;

===============================================================

 

여기서 chain 발생 row 라는 것이 무얼 의미하는지요 ?

또, chain이 발생된 row가 많고 적음이 어떤 것을 의미하는지... 알고 싶어요 ^^

이 글에 대한 댓글이 총 1건 있습니다.
Introduction
------------

This article discusses the difference between row chaining and migration.
Guidelines are given on how to detect and resolve from this situation.


Concepts
--------

There are two circumstances when this can occur, the data for a row in a table
may be too large to fit into a single data block.  This can be caused by either
row chaining or row migration.

  Chaining
  ---------
  Occurs when the row is too large to fit into one data block when it is first
  inserted. In this case, Oracle stores the data for the row in a chain of data
  blocks (one or more) reserved for that segment. Row chaining most often occurs
  with large rows, such as rows that contain a column of datatype LONG, LONG RAW,
  LOB, etc. Row chaining in these cases is unavoidable.


  Migration
  ----------
  Occurs when a row that originally fitted into one data block is updated so
  that the overall row length increases, and the block's free space is already
  completely filled.  In this case, Oracle migrates the data for the entire row
  to a new data block, assuming the entire row can fit in a new block.  Oracle
  preserves the original row piece of a migrated row to point to the new block
  containing the migrated row: the rowid of a migrated row does not change.

When a row is chained or migrated, performance associated with this row
decreases because Oracle must scan more than one data block to retrieve the
information for that row.

o INSERT and UPDATE statements that cause migration and chaining perform poorly,
   because they perform additional processing.

o SELECTs that use an index to select migrated or chained rows must perform
   additional I/Os.



Detection
---------

Migrated and chained rows in a table or cluster can be identified by using the
ANALYZE command with the LIST CHAINED ROWS option. This command collects
information about each migrated or chained row and places this information into
a specified output table.  To create the table that holds the chained rows,
execute script UTLCHAIN.SQL.

  SQL> ANALYZE TABLE scott.emp LIST CHAINED ROWS;
  SQL> SELECT * FROM chained_rows;

You can also detect migrated and chained rows by checking the
'table fetch continued row' statistic in the v$sysstat view.

  SQL> SELECT name, value FROM v$sysstat WHERE name = 'table fetch continued row';
 
  NAME                                                                 VALUE
  ---------------------------------------------------------------- ---------
  table fetch continued row                                              308

Although migration and chaining are two different things, internally they are
represented by Oracle as one.  When detecting migration and chaining of rows
you should analyze carrefully what you are dealing with.


Resolving
---------

o In most cases chaining is unavoidable, especially when this involves tables
  with large columns such as LONGS, LOBs, etc.  When you have a lot of chained
  rows in different tables and the average row length of these tables is not
  that large, then you might consider rebuilding the database with a larger
  blocksize.
 
  e.g.: You have a database with a 2K block size. Different tables have multiple
        large varchar columns with an average row length of more than 2K.  Then this
        means that you will have a lot of chained rows because you block size is
        too small.  Rebuilding the database with a larger block size can give you
        a significant performance benefit.
       
o Migration is caused by PCTFREE being set too low, there is not enough room in
  the block for updates.  To avoid migration, all tables that are updated should
  have their PCTFREE set so that there is enough space within the block for updates.
  You need to increase PCTFREE to avoid migrated rows.  If you leave more free
  space available in the block for updates, then the row will have more room to
  grow.
 
  SQL Script to eliminate row migration :
 
  -- Get the name of the table with migrated rows:
  ACCEPT table_name PROMPT 'Enter the name of the table with migrated rows: '
 
  -- Clean up from last execution
  set echo off
  DROP TABLE migrated_rows;
  DROP TABLE chained_rows;
 
  -- Create the CHAINED_ROWS table
  @.../rdbms/admin/utlchain.sql
  set echo on
  spool fix_mig
  -- List the chained and migrated rows
  ANALYZE TABLE &table_name LIST CHAINED ROWS;
 
  -- Copy the chained/migrated rows to another table
  create table migrated_rows as
    SELECT orig.*
    FROM &table_name orig, chained_rows cr
    WHERE orig.rowid = cr.head_rowid
      AND cr.table_name = upper('&table_name');
     
  -- Delete the chained/migrated rows from the original table
  DELETE FROM &table_name WHERE rowid IN (SELECT head_rowid FROM chained_rows);
 
  -- Copy the chained/migrated rows back into the original table
  INSERT INTO &table_name SELECT * FROM migrated_rows;
 
  spool off
 

Note
----

When you run the script in the document to clean up the chained rows if the
table contains long raw columns, the script will fail with ORA-997: Illegal use
of LONG datatype. This error is normal as you cannot do a CTAS when you have
long raws. Also, by the nature of the long raw datatype, chaining is
unavoidable.

 

최기국님이 2006-05-08 17:03에 작성한 댓글입니다.
이 댓글은 2006-05-08 17:05에 마지막으로 수정되었습니다. Edit
[Top]
No.
제목
작성자
작성일
조회
26678연속적이지 않은 날짜데이터의 바로 직전 일자 데이타와의 연산 문제 [1]
이진웅
2006-05-08
2372
26677v$session, v$sqltext 에 대해서... [3]
까먹지마
2006-05-08
2484
26676프로시져에서 데이터가 있으면 테이블조인을 하고 그렇지 않는경우 조인을 하지 않는 방법이 있습니까? [1]
조기영
2006-05-08
1396
26675chained rows 가 뭘 의미 하는 건지요 ? [1]
까먹지마
2006-05-08
3109
26674Package를 권한 설정할 때... [2]
초보
2006-05-08
4692
26673오라클에서 숫자만 검색할려면 어떻게 하나요??? [2]
문상옥
2006-05-08
5081
26670imp 할 때 error가 발생합니다. [1]
이수정
2006-05-08
2999
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.025초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다