close

Update statistics 是最被人誤解的指令 , 其中包含
不同版本的 IDS 所作的修正!! 就跟 B-tree 一樣 ,
以下將逐次討論,並且說明差異 ,如果有新文件, 將逐步貼上 !!!!

update statistics high 以及 update statistics medium 差別在於
樣本大小...high 是 table 所有的資料 , medium 則是採樣方式 ,
可以透過 set explain on ; 觀察 update statistics 的數據!!!!

值得注意的是 , update statistics 加上 "for table" 才不會 compile Stored procedure ,
你在PDQPRIORITY=50 情況之下作 update statistics 沒有 for table , 那麼
Stored procedure 就會使用 PDQPRIORITY=50 在它的query plan,
不管執行當時的PDQPRIORITY是多少 !!!所以要小心呀!!~~~

另外一個需要特別注意的是,當你作update statistics for stored procedure 的時候 ,
IDS 會依據當時 Stored procedure 的 query plan 紀錄下來,所以,選擇 procedure 中想要作
update statistics 的 tables 都先執行 update statistics ,然後再執行 stored procedure 的
update statistics 才能達到最佳的結果 ,順序反過來的話,performance 會大打折扣的!!

如果table是fragmented,PDQPRIORITY 被用來計算多少個fragment被平行scanned ~
如果PDQPRIORITY=0,fragment將被一個接一個scanned,如果PDQPRIORITY=4,
4*10=40% of fragments 被平行scanned,PDQPRIORITY=10(or above),則是100%的fragments被平行scanned,

Default sorting memory for update statistics is 15M .

DBUPSPACE 設定 update statistics 需要的 memory default 值 ,格式是
{max disk space}:{default memory}. 如果需要 35M , 就設定為 0:35 ,
PDQPRIORITY=0時,這個值最大是50M ,要想使用比50M更大的memory作update statistics ,
就必須設定 PDQPRIORITY 環境變數來使用 MGM 的 memory 空間!

PSORT_NPROCS and PSORT_DBTEMP 行為跟之前沒有差別 .

set explain 要看的是 SORT DATA 跟 SORT MEMORY GRANTED 這兩個值 ,
如果 SORT MEMORY GRANTED 只有 50M , 而 SORT DATA 大於 SORT MEMORY GRANTED ,
就 設 PDQPRIORITY 跟 DS_TOTAL_MEMORY ,如果你設 DS_TOTAL_MEMORY =80M ,
PDQPRIORITY=50 , 你會得到 40M 的memory !!

如果你需要的 memory < 50M ,而且你 disable index scan , 那就使用DBUPSPACE 環境變數吧,
{max disk space}:{default memory}:{Options) ,
Options : 2=Disable Index Scans & Enable more information to be printed
Options : 1=Enable more information to be printed

DBUPSPACE 順序優於 PDQPRIORITY , 你如果像要 disable index scan 同時要使用DS_TOTAL_MEMORY,
就 DBSPACE=0:0:2 , PDQPRIORITY=100 !!!

其餘詳見:
http://www.ibm.com/developerworks/db2/zones/informix/library/techarticle/miller/0203miller.html#section3

arrow
arrow
    全站熱搜

    hedgezzz 發表在 痞客邦 留言(0) 人氣()