![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
| 1 |
|
| 97475.8 97475.8 |
|
| 1.36466e+07 1.36466e+07 |
#2
| |||
| |||
|
|
Guys, DB2 LUW v9.5 fp5 Not sure if I am missing something obvious, but: select MIN(COLLECT_TIME), MAX(COLLECT_TIME) from RTM.TBL_COLLECT_IOSTAT_AIX_RTM where MACHINE_ID=? Access Plan: ----------- Total Cost: 38.4499 Query Degree: 1 Rows RETURN ( 1) Cost I/O | 1 NLJOIN ( 2) 38.4499 9.59622 /-----+------\ 1 1 GRPBY GRPBY ( 3) ( 5) 19.2247 19.2247 4.79809 4.79813 | | 97475.8 97475.8 IXSCAN IXSCAN ( 4) ( 6) 5428.06 5428 1354.74 1354.74 | | 1.36466e+07 1.36466e+07 INDEX: RTM INDEX: RTM IIOSTAT_AIX IIOSTAT_AIX Q1 Q4 Index IIOSTAT_AIX description: COLNAMES REVERSE_SCANS -------------------------------------------------- ------------- +MACHINE_ID+COLLECT_TIME+DISK_NAME Y Since the above query runs for quite some time, I tried db2advis out of curiosity: db2advis -d RTMDB -s "select MIN(COLLECT_TIME), MAX(COLLECT_TIME) from RTM.TBL_COLLECT_IOSTAT_AIX_RTM where MACHINE_ID=?" Suggested index: CREATE INDEX "DB2INST1"."IDX101142031030000" ON "RTM "."TBL_COLLECT_IOSTAT_AIX_RTM" ("MACHINE_ID" ASC, "COLLECT_TIME" DESC) ALLOW REVERSE SCANS COLLECT SAMPLED DETAILED STATISTICS; Since IIOSTAT_AIX already has REVERSE_SCANS enabled, I thought the optimizer could use it for both MIN / MAX aggregations in the query. Does REVERSE_SCAN apply to all columns in the index, or only to the first one ? |
#3
| |||
| |||
|
|
If I've got it right "allow reverse scans" means that you can scan leaf pages in the index in both directions, i.e all columns. I doubt that the proposed index will improve anything, what performance gain does db2advis think it will give you? |
|
What is the output of: select FIRSTKEYCARD, FIRST2KEYCARD from syscat.indexes where indname = 'IIOSTAT_AIX' |
#4
| |||
| |||
|
|
If I've got it right "allow reverse scans" means that you can scan leaf pages in the index in both directions, i.e all columns. I doubt that the proposed index will improve anything, what performance gain does db2advis think it will give you? db2advis estimates 32% of performance improvement. I guess this is fairly significant in this scenario. What is the output of: select FIRSTKEYCARD, FIRST2KEYCARD from syscat.indexes where indname = 'IIOSTAT_AIX' Here: FIRSTKEYCARD * * * * FIRST2KEYCARD -------------------- -------------------- * * * * * * * * *140 * * * * * * * 165893 Thanks *again for your feedback, -M |
![]() |
| Thread Tools | |
| Display Modes | |
| |