CanNeverThinkOfaName
Programmer
Hi all
This query takes WAY too long to run (over an hour) - can anyone think of any other way to write it please?!!
addate is something like '06/10/2008' and addtime is 14:57:00' but they are stored in seperate columns in the database.
If I say just one day on the last line- instead of >= X and <= Y -it only takes 10 mins(still terrible but better than nothing!)
If you would like some sample data or more background let me know!
thanks for any help in advance!
This query takes WAY too long to run (over an hour) - can anyone think of any other way to write it please?!!
Code:
SELECT to_Date((to_char(A.ADDATE,'dd/mm/yyyy')||' '||A.ADTIME),'dd/mm/yyyy hh24:mi:ss'), B.ACCOUNTID,
A.CAMPAIGN, ( C.TITLE ), A.WEEK, C.TITLE,
D.TITLE
FROM A, B, C, D, E
WHERE ( E.POID_ID0=D.OBJ_ID0 )
AND ( E.ACCOUNT_NO=B.ACCOUNTID(+) )
AND ( C.EXTERNALNO(+)=B.CHANNELID )
AND ( B.USAGETIMESTAMP between (to_Date((to_char(A.ADDATE,'dd/mm/yyyy')||' '||A.ADTIME),'dd/mm/yyyy hh24:mi:ss') - ((1/24/60)*10)) and
(to_Date((to_char(A.ADDATE,'dd/mm/yyyy')||' '||A.ADTIME),'dd/mm/yyyy hh24:mi:ss') + ((1/24/60)*10)) )
AND ( ( C.TITLE ) = '4' )
and trunc(to_Date((to_char(A.ADDATE,'dd/mm/yyyy')||' '||A.ADTIME),'dd/mm/yyyy hh24:mi:ss')) >= '6-oct-08' and
trunc(to_Date((to_char(A.ADDATE,'dd/mm/yyyy')||' '||A.ADTIME),'dd/mm/yyyy hh24:mi:ss')) <= '8-oct-08'
addate is something like '06/10/2008' and addtime is 14:57:00' but they are stored in seperate columns in the database.
If I say just one day on the last line- instead of >= X and <= Y -it only takes 10 mins(still terrible but better than nothing!)
If you would like some sample data or more background let me know!
thanks for any help in advance!