我们有一个永远运行的简单查询。我可以说10多个小时。事实表有超过 170 亿行。关于提高以下查询性能的任何建议或最佳实践?
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
这是计划
OPERATION OBJECT_NAME OPTIONS COST PARTITION_START PARTITION_STOP
SELECT STATEMENT 10931402
PX COORDINATOR
PX SEND :TQ10005 QC (ORDER) 10931402
SORT ORDER BY 10931402
PX RECEIVE 10931402
PX SEND :TQ10004 RANGE 10931402
SORT GROUP BY 10931402
PX RECEIVE 10931402
PX SEND :TQ10003 HASH 10931402
SORT GROUP BY 10931402
HASH JOIN 1964410
Access Predicates
F.DM_PRODUCT_HKEY=P.DM_PRODUCT_HKEY
PX RECEIVE 335
PX SEND :TQ10002 BROADCAST 335
VIEW index$_join$_002 335
HASH JOIN BUFFERED
Access Predicates
ROWID=ROWID
PX RECEIVE 136
PX SEND :TQ10000 HASH 136
PX
BLOCK
ITERATOR 136
INDEX DM_PRODUCT_HIERARCHY_PK FAST FULL
SCAN
136
PX RECEIVE 280
PX SEND :TQ10001 HASH 280
PX
BLOCK
ITERATOR 280
INDEX DM_PRODUCT_HIERARCHY_LPK FAST FULL
SCAN
280
PX BLOCK ITERATOR 1878718 1 369
TABLE ACCESS DM_CUST_RENEWAL_ADV_FACT FULL 1878718 1 369