Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How i can rewrite the below query

user590978Apr 15 2014 — edited Apr 18 2014

Hi,

This is DW query and taking long time to run..Can you please help me to rewrite the query in other way to increase the performance.

{code}

SELECT /*+ parallel(AL2,4) */

AL2.DM_PRODUCT_HKEY,

AL2.DM_WEEK_END_DATE_DKEY,

NVL(AL1.DM_SEGMENTATION_DKEY,-100) AS DM_SEGMENTATION_DKEY,

NVL(AL1.DM_TRAVELER_STATUS_DKEY,-100) AS DM_TRAVELER_STATUS_DKEY,

NVL(AL1.DM_TRAV_ON_SEGM_DKEY,8) AS DM_TRAV_ON_SEGM_DKEY,

SUM ((NVL(AL1.HH_COUNT,1)/NVL(AL1.TOTAL_HH_COUNT,1))*AL2.TIMED_TOTAL_ADV_COST )  AS ADVG_COST_ACTUALS,

AL3.PRODUCT_YEAR AS YEAR

FROM ADVT_WRK_TBL AL2

INNER JOIN MKTRPT_VW AL3

ON (AL2.DM_PRODUCT_HKEY=AL3.DM_PRODUCT_HKEY)

INNER  JOIN HH_COUNT_FACT AL1

ON (AL2.DM_PROMOTIONS_DKEY=AL1.DM_PROMOTIONS_DKEY

AND AL3.PRODUCT_YEAR=AL1.YEAR )

GROUP BY

AL2.DM_PRODUCT_HKEY,

AL3.PRODUCT_YEAR,

NVL(AL1.DM_SEGMENTATION_DKEY,-100),

NVL(AL1.DM_TRAVELER_STATUS_DKEY,-100),

NVL(AL1.DM_TRAV_ON_SEGM_DKEY,8),

AL2.DM_WEEK_END_DATE_DKEY

{code}

This is view i am USING MKTRPT_VW for one of the joining above.

Thanks in advance!..

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 16 2014
Added on Apr 15 2014
11 comments
697 views