The solution for your db2 performance problem.
Suppose you want to impose the constraint col1>100 order by col3. Do the following to improve SQL performance.
SQL statement:
Select Col1, Col2, Col3, Col4 from TABLE1 where Col1>100 order by Col3
To improve performance:
1. create index INDEX1 on TABLE1 (Col1, Col3) CLUSTER
2. reorg table TABLE1 index INDEX1 use TEMPSPACE1
3. runstats on table TABLE1 with distribution and detailed indexes all
NOTE: you only need to do the above steps once and should improve the performance when running the above SQL statement.
Suppose you want to impose the constraint col1>100 order by col3. Do the following to improve SQL performance.
SQL statement:
Select Col1, Col2, Col3, Col4 from TABLE1 where Col1>100 order by Col3
To improve performance:
1. create index INDEX1 on TABLE1 (Col1, Col3) CLUSTER
2. reorg table TABLE1 index INDEX1 use TEMPSPACE1
3. runstats on table TABLE1 with distribution and detailed indexes all
NOTE: you only need to do the above steps once and should improve the performance when running the above SQL statement.