¾È³çÇϼ¼¿ä. DB2 ¹× XpertMon »ç¿ëÀÚ¿©·¯ºÐ. ¢ß ¾ÆÀÌƼ¿¢½ºÆÛÆ®±×·ì DB »ç¾÷ºÎÀÔ´Ï´Ù.
ÇöÀç, ÀúÈñ´Â Monitoring »Ó¸¸ ¾Æ´Ï¶ó, Admin ¾÷¹«¸¦ XpertMonÀ» ÀÌ¿ëÇÏ¿© ¼öÇàÇÏ½Ç ¼ö ÀÖµµ·Ï
Çϱâ À§ÇÏ¿© Admin Component ¼³°èÀÛ¾÷À» ÁøÇàÇÏ°í ÀÖ½À´Ï´Ù. Ãß°¡µÇ°Å³ª, º¯°æµÇ´Â
±â´Éµé¿¡ ´ëÇؼ´Â ¾ÕÀ¸·Î °è¼ÓÀûÀ¸·Î ¼Ò°³ÇØ µå¸®µµ·Ï ÇÏ°Ú½À´Ï´Ù.
À̹øÁÖ ´º½º·¹ÅÍ ÁÖÁ¦´Â Include Index ±â´É¿¡ ´ëÇÑ ³»¿ëÀÔ´Ï´Ù.
Ãß°¡ÀûÀ¸·Î ´º½º·¹Å͸¦ Àü´ÞÇÏ°í ½ÍÀº °í°´ÀÌ ÀÖÀ¸½Ã´Ù¸é, ¼º¸í°ú ¿¬¶ôó, ¸ÞÀÏÁÖ¼Ò¸¦
¾Ë·ÁÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù.
DB2 UDB - non-index data retrieval
DB2 UDB¿¡´Â µ¥ÀÌÅÍ ÆäÀÌÁö¸¦ ÀÐÁö ¾Ê°íµµ, Index¸¦ ÀÌ¿ëÇÏ¿© Non-Key Data¸¦ °Ë»öÇÏ´Â
¹æ¹ýÀÌ ÀÖ½À´Ï´Ù.
ÀÌ ³ª¸ÓÁö µ¥ÀÌÅÍ´Â IndexÀÇ °íÀ¯¼ºÀ» üũÇϴµ¥´Â Æ÷ÇÔµÇÁö ¾ÊÀ¸¸é¼ Index¿¡ Æ÷ÇԵǾî,
Data Page¸¦ ÀÐÁö ¾Ê°íµµ µ¥ÀÌÅ͸¦ ó¸®ÇÒ ¼ö ÀÖµµ·Ï ÇÏ¿©, Performance È¿°ú¸¦ ³ô¿©ÁÝ´Ï´Ù.
AIX ¸Ó½Å¿¡ DB2 UDB For Aix 8.1 FP3¸¦ ¼³Ä¡ÇÕ´Ï´Ù.
SAMPLE DBÀÇ EMPLOYEE Å×À̺íÀ» ÀÌ¿ëÇÏ¿© ¾Æ·¡¿Í °°ÀÌ Å×½ºÆ®Çϵµ·Ï ÇÕ´Ï´Ù.
EMPLOYEE Table¿¡´Â empno, firstnme, midinit, lastname, workdept, phoneno, hiredate,
job, edlevel, sex, birthdate, salary, bonus, and commÀÇ ColumnÀÌ ÀÖ½À´Ï´Ù
¿©±â¼´Â EMPLOYEE Å×À̺íÀÇ EMPNO¿Í PHONENO Ä÷³À» Select ÇÏ°íÀÚ ÇÕ´Ï´Ù.
´ÙÀ½ÀÇ µÎ°³ÀÇ ½Ã³ª¸®¿À¸¦ °¡Áö°í °á°ú¸¦ ºñ±³Çغ¸µµ·Ï ÇÏ°Ú½À´Ï´Ù.
1) EMPNO ·Î INDEX ¸¦ ¸¸µé°í Select
2) EMPNO ·Î INDEX ¸¦ ¸¸µéµÇ, PHONENO Ä÷³À» non-key part·Î ±¸¼ºÇÏ¿© Select
1¹ø TEST
1) EMPNO·Î INDEX¸¦ ¸¸µì´Ï´Ù.
> db2 connect to sample
> db2 create unique index emp_ix1 on employee (empno)
2) db2explnÀ» »ç¿ëÇÏ¿© SQLÀ» ½ÇÇàÇÕ´Ï´Ù.
>db2expln -d sample -q "select phoneno from employee where empno = `000010`" -t
3) OUTPUT
SQL Statement:
select phoneno
from employee
where empno = `000010`
Section Code Page = 970
Estimated Cost = 296231.312
Estimated Cardinality = 1.000000
Access Table Name = UDBEEE.EMPLOYEE ID = 2,5
| #Columns = 2
| Single Record
| Index Scan: Name = UDBEEE.EMP_IX1 ID = 1
| | Regular Index (Not Clustered)
| | Index Columns:
| | | 1: EMPNO (Ascending)
| | #Key Columns = 1
| | | Start Key: Inclusive Value
| | | | 1: `000010`
| | | Stop Key: Inclusive Value
| | | | 1: `000010`
| | Data Prefetch: None
| | Index Prefetch: None
| Lock Intents
| | Table: Intent Share
| | Row : Next Key Share
| Return Data to Application
| | #Columns = 1
Return Data Completion
End of section
ÀÌ °á°úÀÇ COST´Â
296231.312ÀÔ´Ï´Ù.
¿©±â¼ Àá±ñ !!!
XpertMon¿¡¼ SQL RUNNER¸¦ ÀÌ¿ëÇϸé INDEX¸¦ »ý¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.
±× ´ÙÀ½ EXPLAINÀ» ÀÌ¿ëÇϸé Explain OUTPUTÀ» º¼ ¼ö ÀÖ½À´Ï´Ù.
¼³¸í >
2) Index Scan À» ¼öÇàÇÏ¿´½À´Ï´Ù. ( UDBEEE.EMP_IX1 À̶ó´Â À妽º¸¦ ÀÌ¿ëÇÏ¿´°í,
¾à 19387.140 Á¤µµÀÇ cost°¡ ¼Ò¸ðµÇ¾ú½À´Ï´Ù.)
1) Fetch Table Data ¸¦ ¼öÇàÇÏ¿´½À´Ï´Ù. (Å×À̺íÀÇ µ¥ÀÌÅ͸¦ Fetch ÇÏ¿´½À´Ï´Ù.
±×¸®°í, ¿©±â±îÁö 296231.312 Á¤µµÀÇ Cost°¡ ¼Ò¸ðµÇ¾ú½À´Ï´Ù. ).
Fetch Table Data¸¦ ¼öÇàÇÑ ÀÌÀ¯´Â Index¸¸À¸·Î SQLÀ» ó¸®ÇÒ ¼ö ¾øÀ¸¹Ç·Î, ÇÊ¿äÇÑ µ¥ÀÌÅ͸¦
Àбâ À§ÇØ Å×À̺í·Î °¡¼ °Ë»öÇß´Ù´Â ÀǹÌÀÔ´Ï´Ù. PHONENO¶ó´Â Ä÷³ÀÌ EMP_IX1À̶ó´Â
À妽º¿¡ Á¸ÀçÇÏÁö ¾Ê¾Ò±â ¶§¹®¿¡ ¹ß»ýÇÑ °ÍÀÔ´Ï´Ù. Fetch Table Data¸¦ ÇÔÀ¸·Î½á Cost°¡
±âÇϱ޼öÀûÀ¸·Î ¸¹¾ÆÁ³À½À» º¼ ¼ö ÀÖ½À´Ï´Ù.
2¹ø TEST
1) INCLUDE¹®À» »ç¿ëÇÏ¿© PHONENO¸¦ Æ÷ÇÔÇÑ EMPNO·Î INDEX¸¦ ¸¸µì´Ï´Ù
>db2 create unique index emp_ix2 on employee (empno) include (phoneno)
2) DB¿¡ ´Ù½Ã Connect¸¦ ÇÕ´Ï´Ù
>db2 connect reset
>db2 connect to sample
3) db2explnÀ» »ç¿ëÇÏ¿© SQLÀ» ½ÇÇàÇÕ´Ï´Ù.
>db2expln -d sample -q "select phoneno from employee where empno =`000010`" -t
4) OUTPUT
SQL Statement:
select phoneno
from employee
where empno = `000010`
Section Code Page = 970
Estimated Cost = 26128.138
Estimated Cardinality = 1.000000
Access Table Name = UDBEEE.EMPLOYEE ID = 2,5
| #Columns = 1
| Single Record
| Index Scan: Name = UDBEEE.EMP_IX2 ID = 2
| | Regular Index (Not Clustered)
| | Index Columns:
| | | 1: EMPNO (Ascending)
| | | 2: PHONENO (Include Column)
| | #Key Columns = 1
| | | Start Key: Inclusive Value
| | | | 1: `000010`
| | | Stop Key: Inclusive Value
| | | | 1: `000010`
| | Index-Only Access
| | Index Prefetch: None
| | Return Data to Application
| | | #Columns = 1
| Lock Intents
| | Table: Intent Share
| | Row : Next Key Share
Return Data Completion
End of section
XpertMonÀ» ÀÌ¿ëÇÏ¿© EXPLAIN À» ¼öÇàÇÏ¸é ¾Æ·¡¿Í °°ÀÌ ³ªÅ¸³³´Ï´Ù.
¼³¸í>
1) Index ScanÀ» ¼öÇàÇÏ¿´½À´Ï´Ù. À妽ºÀ̸§Àº UDBEEE.EMP_IX2 ÀÔ´Ï´Ù. Cost´Â 26128.138 ÀÔ´Ï´Ù.
´ÙÀ½¿¡ Data Operation Complete À̹ǷÎ, Index ¸¸ ÀÐ¾î¼ SQLÀ» ó¸®ÇÏ¿´½À´Ï´Ù.
ÀÌ·¯ÇÑ Index ScanÀ» Index Only Access ¶ó°í ÇÕ´Ï´Ù.
ÀÌ °á°úÀÇ COST´Â
26128.138ÀÌ°í INDEX - ONLY AccessÇÏ´Â °ÍÀ» ¾Ë ¼ö ÀÖ½À´Ï´Ù.
Áï INDEX¸¦ »ç¿ëÇÑ COST¸¦ ºñ±³ÇØ º¸¸é 296231.312¿¡¼ 26128.138À¸·Î °¨¼Ò ÇßÀ½À» ¾Ë ¼ö ÀÖ½À´Ï´Ù.
¸¸¾à Query¿¡ ´Ù¸¥ ColumnÀ» Ãß°¡ÇÏ¿© TEST ÇØ º¸¸é (¿¹¸¦ µé¾î firstnme)
select
firstnme, phoneno from employee where empno = `000010`
°á°ú´Â COST°¡
313008.375·Î 1¹ø TESTº¸´Ù ´õ ³ôÀ½À» ¾Ë ¼ö ÀÖ½À´Ï´Ù.
±× ÀÌÀ¯´Â FirstnmeÀ̶õ Á¤º¸¸¦ ¾ò±â À§ÇÏ¿© DATA PAGE¿¡ °¡±â ¶§¹®ÀÔ´Ï´Ù.
ÀÚ ¿©±â±îÁö INDEX¿¡¼ NON-KEY DATA¸¦ »ç¿ëÇÏ´Â ÀÌÁ¡À» »ìÆì º¸¾Ò½À´Ï´Ù
´Ü, °Ë»öÇÒ Column Á¤º¸°¡ È®½ÇÇÏÁö ¾Ê¾Æ¼, ¿©·¯ °³ÀÇ INDEX¸¦ ÀÛ¼ºÇϰųª,
Á¶ÇÕ(Combination) À¸·Î INDEX ¸¦ ÀÛ¼ºÇÏ´Â °ÍÀº ¿À¹öÇìµå°¡ ÀÖÀ¸¹Ç·Î ÇÇÇØ¾ß ÇÕ´Ï´Ù.
XpertMon for DB2 UDB V2
DB »ç¾÷ºÎ
Tel : 02-2108-1458
Fax : 02-2108-1459
Mobile : 011-896-6545
E-mail :
hjlee@iteg.co.kr
URL :
http://iteg.co.kr