i have query works fast on large dataset:
select q2.* (select q1.*, rownum rn ( select name clientname,to_char(callstart+gmt/24,'mm/dd/yyyy hh24:mi:ss') calldate, name destination,callno dialednumber,ani accountandcallingnumber,bduration duration, to_char(callstart+gmt/24,'yyyy-mm-dd hh24:mi:ss') formattedcalldate, switchid, lineno, fileid cdr join client on client.id=cdr.aniclientid join destination on destination.id=cdr.destinationid join country on destination.countryid=country.id join destinationgroup on destinationgroup.id=destination.parentid callstart >= to_date('01/30/2005 06:56:41','mm/dd/yyyy hh24:mi:ss') , callstart < to_date('07/16/2015 06:56:41','mm/dd/yyyy hh24:mi:ss') order callstart desc ) q1 ) q2 rn >= 0 , rownum <= 10 this executes in 150 ms. but, when add in line
and aniclientid=363 above order callstart, query becomes slow, point not usable.
what elegant way fix this?
can done without adding index? adding 1 may politically difficult.
if not, index on aniclientid fix or need 1 on callstart well? believe bitmap index right aniclient column since there 1800 values. index take space?
i'm bit new sql, indexes... in advance!
Comments
Post a Comment