Tune the SQL Qury [message #302199] |
Sun, 24 February 2008 20:20 |
gentleman777us
Messages: 122 Registered: April 2005
|
Senior Member |
|
|
Hello,
I have the following the SQl query it takes for ever to run the query because it is quering the table which has 7 million records.
I would appreciate if someone help me improve the performance of this query by rewriting it or provide any tips to improve the performance.
select weatherid,
(select DECODE (to_char(min(interval_startdt) ,'HH24MI'), '0000', (trunc(min(interval_startdt))-1)+18/24, TRUNC(min(interval_startdt))+18/24) from weather_data_ont where ind = t.ind)interval_startdt,
2035,
1,
(select DECODE (to_char(max(interval_startdt) ,'HH24MI'), '2330', (trunc(max(interval_startdt))+1)+6/24, TRUNC(max(interval_startdt))+6/24) from weather_data_ont where ind = t.ind) interval_enddt,
min(value),
5,
9998,
sysdate
from weather_data_ont t
where cui_tid = 210 and ind is not null
group by weatherid, ind;
Thanks
|
|
|
|
|