Hi,
I have a question concerning combined index and SUM. The following query needs about 20 minutes:
SELECT vendorid, count(*), SUM(value) from TABLE1 WHERE vendorid=1112233 group by vendorid;
I have an index for the column vendorid. If I skip the SUM part then the query is finished below one second. The amount of entries to sum up is about 300.000.
db2advis told me to make a combined index of (vendorid ASC, value DESC). Now the query is very fast. But I do not understand why the combined index makes the SUM operation faster?