Oracle DB Query timeout when using Group By clause
I have a comprehensive SQL with many nesting Subqueries. At the end on nesting sqls I use Group By statement.
The query can not run (take very log time untill timeout).
However when I remove group by statement, query can return 500k rows in several minutes.
Execution plan shows that it takes 76% CPU time on HASH GROUP BY and 16% CPU time on HASH JOIN RIGHT OUTER.
Please help to solve the problem.
It should be an execution optimazation problem of Oracle DB.