日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
DB2V9.7分區(qū)索引空間占用和掃描性能的描述

我們今天是要和大家一起討論的是DB2 V9.7 分區(qū)索引空間占用和掃描性能,我們大家都知道分區(qū)表主要是應(yīng)用在表比較大的背景下,所以我們使用大表才能測(cè)試出性能。下面我們創(chuàng)建測(cè)試表。

清單 7. 創(chuàng)建測(cè)試大表

 
 
 
  1. drop table t1; 
  2. CREATE TABLE t1 
  3. ( l_orderkey INTEGER NOT NULL, l_partkey 
  4. INTEGER, l_suppkey INTEGER, l_shipdate date, padding1 char(30) 
  5. PARTITION BY RANGE(l_shipdate) 
  6. STARTING '2008-01-01' ENDING '2008-12-31' EVERY 1 MONTH 
  7. INSERT INTO t1 (l_orderkey, l_partkey, l_suppkey,l_shipdate,padding1) 
  8. WITH TEMP (COUNTER, l_orderkey, l_partkey, l_suppkey,l_shipdate,padding1) AS 
  9. ( VALUES (0, MOD(INT(RAND() * 12000000), 25), MOD(INT(RAND() * 12000000), 30), 
  10. MOD(INT(RAND() * 12000000), 30), DATE(MOD(INT(RAND() * 12000000), 366)+733042), 'A') 
  11. UNION ALL SELECT (COUNTER + 1), MOD(INT(RAND() * 12000000), 25), 
  12. MOD(INT(RAND() * 12000000), 30), MOD(INT(RAND() * 12000000), 30), 
  13. DATE(MOD(INT(RAND() * 12000000), 366)+733042), 'A' FROM TEMP 
  14. WHERE (COUNTER + 1) < 12000000 
  15. SELECT l_orderkey, l_partkey, l_suppkey,l_shipdate,padding1 
  16. FROM TEMP 

我們創(chuàng)建的表包含 1200 萬(wàn)行數(shù)據(jù),按照月份每個(gè)月一個(gè)分區(qū),分區(qū)列 l_shipdate 的數(shù)據(jù)分布在’ 2008-01-01 ’和’ 2008-12-31 ’之間,且均勻分布。注意 733042 是日期 2008-01-01 在 DB2 內(nèi)以天數(shù)的表達(dá)形式,是通過(guò) days() 函數(shù)獲得的。

我們首先在列 l_orderkey 上創(chuàng)建非DB2 V9.7 分區(qū)索引。

清單 8. 創(chuàng)建非分區(qū)索引

 
 
 
  1. db2 "Create index idx_nopart_l_orderkey on t1(l_orderkey) not partitioned" 
  2. db2 "runstats on table db2inst1.t1 and indexes all" 
  3. db2 "select substr(INDNAME,1,25) idx_name,NLEVELS,NLEAF,INDCARD 
  4. from syscat.indexes where tabname='T1'" 
  5. DX_NAME NLEVELS NLEAF INDCARD 
  6. IDX_NOPART_L_ORDERKEY 3 16831 12000000 

清單 8 表明,非分區(qū)索引 B 樹(shù)高度為 3 層,具有 16831 個(gè)葉子頁(yè)面。

清單 9. 測(cè)試非DB2 V9.7 分區(qū)索引性能

 
 
 
  1. db2 set current explain mode yes 
  2. db2 values current timestamp 
  3. 2009-07-07-15.46.24.863000 
  4. db2 "select count(*) from t1 " 
  5. ----------- 12000000 
  6. db2 values current timestamp 
  7. 2009-07-07-15.46.27.394000 
  8. db2exfmt -d sample -w -1 -n % -s % -# 0 -t 
  9. Total Cost: 24109.7 
  10. Query Degree: 1 
  11. Rows RETURN ( 1) Cost I/O 
  12. | 1 GRPBY ( 2) 24109.7 17002 | 1.2e+007 IXSCAN ( 3) 23259.5 17002 | 1.2e+007 
  13. INDEX: ADMINISTRATOR 
  14. IDX_NOPART_L_ORDERKEY Q1 

清單 9 表明使用索引 IDX_NOPART_L_ORDERKEY 統(tǒng)計(jì)表 T1 的總行數(shù)時(shí),估計(jì)總成本為 24109.7,IO 次數(shù)估計(jì)為 17002,實(shí)際花費(fèi)時(shí)間為 2.45 秒。

清單 10. 創(chuàng)建分區(qū)索引

 
 
 
  1. db2 "Create index idx_part_l_orderkey on t1(l_orderkey) partitioned" 
  2. db2 "runstats on table db2inst1.t1 and indexes all" 
  3. db2 "select substr(INDNAME,1,25) idx_name,DATAPARTITIONID,NLEVELS,NLEAF,INDCARD 
  4. from syscat.indexpartitions" 
  5. IDX_NAME DATAPARTITIONID NLEVELS NLEAF INDCARD 
  6. IDX_PART_L_ORDERKEY 0 3 1134 1021133 
  7. IDX_PART_L_ORDERKEY 1 3 1062 956131 
  8. IDX_PART_L_ORDERKEY 2 3 1136 1023293 
  9. IDX_PART_L_ORDERKEY 3 3 1098 988650 
  10. IDX_PART_L_ORDERKEY 4 3 1134 1021552 
  11. IDX_PART_L_ORDERKEY 5 3 1100 990715 
  12. IDX_PART_L_ORDERKEY 6 3 1134 1020850 
  13. IDX_PART_L_ORDERKEY 7 3 1137 1023727 
  14. IDX_PART_L_ORDERKEY 8 3 1101 991839 
  15. IDX_PART_L_ORDERKEY 9 3 1133 1020225 
  16. IDX_PART_L_ORDERKEY 10 3 1078 970906 
  17. IDX_PART_L_ORDERKEY 11 3 1078 970979 

清單 10 表明,分區(qū)索引 idx_part_l_orderkey 具有 12 個(gè)分區(qū),B 樹(shù)高度為 3 層,合計(jì)具有 13325 個(gè)葉子頁(yè)面,葉子頁(yè)面數(shù)比非分區(qū)索引下降 20% 。

清單 11. 測(cè)試DB2 V9.7 分區(qū)索引性能

 
 
 
  1. db2 set current explain mode yes 
  2. db2 values current timestamp 
  3. 2009-07-07-15.59.09.722000 
  4. db2 "select count(*) from t1 " 
  5. ----------- 12000000 
  6. db2 values current timestamp 
  7. 2009-07-07-15.59.11.910000 
  8. db2exfmt -d sample -w -1 -n % -s % -# 0 -t 
  9. Total Cost: 24109.7 
  10. Query Degree: 1 Total Cost: 22059.4 
  11. Query Degree: 1 
  12. Rows RETURN ( 1) Cost I/O | 1 GRPBY ( 2) 
  13. 22059.4 14178.4 | 1.2e+007 IXSCAN ( 3) 21209.2 14178.4 | 1.2e+007 
  14. INDEX: ADMINISTRATOR 
  15. IDX_PART_L_ORDERKEY Q1 

清單 11 表明使用索引 IDX_PART_L_ORDERKEY 統(tǒng)計(jì)表 T1 的總行數(shù)時(shí),估計(jì)總成本為 22059.4,比非分區(qū)索引下降 8.5%,IO 次數(shù)估計(jì)為 14178.4,比非分區(qū)索引下降 16%, 實(shí)際花費(fèi)時(shí)間為 2.19 秒,比非分區(qū)索引下降 10% 。

上述測(cè)試表明,DB2 V9.7 分區(qū)索引在空間占用、掃描性能方面比非分區(qū)索引具有一定的性能優(yōu)勢(shì)。


網(wǎng)站名稱:DB2V9.7分區(qū)索引空間占用和掃描性能的描述
本文來(lái)源:http://www.5511xx.com/article/dpchhcg.html