|
深刻啊!还有一个1166257*1460的排序,这么说来即使我想方设法把sortheap增大也无济于事,因为需要的sortheap太大了!
原帖由 wangzhonnew 于 2008-5-6 19:22 发表 ![]()
got questions, for your comment (2), why do you think MSJOIN is correct? i was thinking SORT may underestimated the cost because for a small SORTHEAP, 3 sorts in the plan may overflow to tempspace or even overflow to disk... (but didn't do manual calculation, just a brief idea)
i think you mean TBSCAN on CUST_BILLSUM_200 was correct, because most of the rows in the table are NOT NULL...
3) when optlvl<2 db2 uses greedy algorithm rather than dynamic programming, especially in opt=0, which will pickup index whenever possible, so that's a common way to test how's the runtime performance with using an index
4) yeah you are right, the whole row will be placed in sortheap, unless the plan uses FETCH on top, TBSCAN+SORT on outter side and table name on inner side...
ex:
9) SORT : (Sort)
Cumulative Total Cost: 2.61297e+006
Cumulative CPU Cost: 1.72482e+010
Cumulative I/O Cost: 474282
Cumulative Re-Total Cost: 0
Cumulative Re-CPU Cost: 0
Cumulative Re-I/O Cost: 159922
Cumulative First Row Cost: 2.61297e+006
Cumulative Comm Cost: 0
Cumulative First Comm Cost: 0
Estimated Bufferpool Buffers: 547612
Arguments:
---------
DUPLWARN: (Duplicates Warning flag)
FALSE
NUMROWS : (Estimated number of rows)
1166257
PARTCOLS: (Table partitioning columns)
1: Q3."CUST_ID"
ROWWIDTH: (Estimated width of rows)
780
SORTKEY : (Sort Key column)
1: Q3."CUST_ID"(A)
SORTTYPE: (Intra-Partition parallelism sort type)
PARTITIONED
SPILLED : (Pages spilled to bufferpool or disk)
233252
TEMPSIZE: (Temporary Table Page Size)
4096
UNIQUE : (Uniqueness required flag)
FALSE
in this sort, please note that ROWWIDTH=780 and NUMROWS=1166257, so from calculation 780*1166257/1024/1024~=867MB.... that means at least 867MB of sortheap will be required for this particular sort.... and please note there are 3 sorts in the original plan....
3) when optlvl |
|