Hi,
I have a query which is specifically user/BO query…
It is taking lot of time ..
How to improve the performance of the same..
Below is the query and index/stats information..
LOCKING tab1 FOR ACCESS
SELECT
tab2.TODAY_DATE,
tab3.CIRCLE_NAME,
COALESCE(tab4.CALL_DIRECTION_ID,'SMS_MO','SMMO','SMS_MT','SMMT','DIAMETER','GPRS',tab4.CALL_DIRECTION_ID),
COUNT(DISTINCT tab1.CP_ACCOUNT_KEY),
SUM(tab1.CALL_COUNT),
SUM(tab1.CALL_DURATION)/60
FROM
tab2,
tab3,
tab4,
tab1
WHERE
( tab4.CALL_DIRECTION_KEY=tab1.CALL_DIRECTION_KEY )
AND ( tab3.GEOGRAPHY_KEY=tab1.CIRCLE_KEY )
AND ( tab2.TIME_KEY=tab1.DAY_KEY )
AND ( tab4.CALL_DIRECTION_ID NOT IN ('TRANSIT-O','TRANSIT-I','TRANS','TRANSIT','TRA','TRAN','-901','-902','0','50','1','2','3') )
AND
tab2.TODAY_DATE BETWEEN {d '2012-07-01'} AND {d '2012-07-07'}
GROUP BY
1,
2,
3
tab1
PRIMARY INDEX ( DAY_KEY ,CIRCLE_KEY ,CALL_SCENARIO_KEY ,CALL_DIRECTION_KEY ,CALL_TYPE_KEY ,CP_ACCOUNT_KEY )
PARTITION BY RANGE_N(CAST((SUBSTR(TRIM(BOTH FROM DAY_KEY ),1 ,8 )) AS DATE FORMAT 'YYYYMMDD') BETWEEN '2012-01-01' AND '2017-12-31' EACH INTERVAL '1' DAY ,
NO RANGE, UNKNOWN)
INDEX idx1 ( DAY_KEY ,CIRCLE_KEY ,CALL_DIRECTION_KEY );
COLLECT STATS ON tab1 COLUMN (day_key)
COLLECT STATS ON tab1 COLUMN (cp_account_key);
COLLECT STATS ON tab1 COLUMN (day_key,circle_key,call_direction_key);
Thanks
↧