optimize query [message #353490] |
Tue, 14 October 2008 00:56 |
ora_baby
Messages: 89 Registered: May 2008
|
Member |
|
|
hi all
i have report with query
select col0, col3*col4 col6, col3+col4+col5 col7
from (
select
case when col1>10 then 1 else 0 col3,
case when col2>20 then 1 else 0 col4,
col*col2 col5,
col0
from (
select
case when A then 1 else 0 col1,
case when B then 1 else 0 col2
col0
from table_T
)
)
i think it is enough for understand problem
for query:
total CPU =11,24; disk=33505; query=83050
and many time for execute
do you have any ideas for optimize this query?
{ps. sorry for my language}
|
|
|
|
|
Re: optimize query [message #353509 is a reply to message #353505] |
Tue, 14 October 2008 01:23 |
ora_baby
Messages: 89 Registered: May 2008
|
Member |
|
|
This query is approximate.
Main idea of this query to show hierarchy of query and many function such as case, sum.
Really this query other (very large) and it have many condition.
|
|
|
|
Re: optimize query [message #354133 is a reply to message #353664] |
Thu, 16 October 2008 09:24 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
If the lowest level of Case statements depend solely on the values returned from table T, then you might get a slight performance increase by creating a function based index to return those CASE expressions.
Of course, it's possible that you have a WHERE clause that would prevent this from happening, but you chose not to share that information with us.
|
|
|