Tune a simple inner join query

2020-05-09 01:50发布

I am trying hard to tune my SQL query. I am relative not an expert in tuning SQL as i come from MDBMS tech

Here is the query

SELECT
  /*+ parallel(f 4) */
  F.DM_CUSTOMER_DKEY,
  P.PRODUCT_YEAR,
  SUM(F.ADVG_COST_ACTUALS) advg_cost_actuals
FROM DM_CUST_RENEWAL_ADV_FACT F
INNER JOIN DM_PRODUCT_HIERARCHY p
ON F.DM_PRODUCT_HKEY = P.DM_PRODUCT_HKEY
GROUP BY F.DM_CUSTOMER_DKEY,
  P.PRODUCT_YEAR
ORDER BY P.PRODUCT_YEAR 

I know fact table has multi billion records. Though, I am not sure how many as my count (*) statement take for ever to return the result. Any tuning/optimizing ideas around above statement would be greatly appreciated.

Thanks, NM

0条回答
登录 后发表回答