Need help in optimizing large SQL statement ( SUM, GROUP BY... )
From: Dean R Money <dmoney_at_magnus.acs.ohio-state.edu>
Date: 3 Aug 1994 18:40:08 GMT
Message-ID: <31ooa8$924_at_charm.magnus.acs.ohio-state.edu>
Date: 3 Aug 1994 18:40:08 GMT
Message-ID: <31ooa8$924_at_charm.magnus.acs.ohio-state.edu>
I've got an SQR that's taking several hours to run, and even then, it often crashes for lack of temp table space.
The basic SQL statement in the SQR is a join between a view and two large tables, with a SUM being computed on 4 columns, grouping by 6 other columns (hey, I didn't write this... I'm just trying to fix it). Using the Cost Optimizer, the explain plan reveals a cost of over 2 trillion!
Does anybody have any suggestions? Any keys to optimizing statements with SUMs and GROUP BYs? Please help!
Dean.
dmoney_at_magnus.acs.ohio-state.edu
Received on Wed Aug 03 1994 - 20:40:08 CEST