1 Reply Latest reply: Jun 12, 2012 3:23 PM by B Aydin RSS

    Optimize IF Statement

      Is there a better way to right this IF Statement? This load currently takes 40 minutes on 10 Millions records.

       

      InterfaceTraffic1:

      Load

      *, IF(sum(InBandwidth)+sum(OutBandwidth)=0,0,

      IF(sum(InBandwidth)=0,sum(OutBandwidth/OutBandwidth) * 100,

      IF(sum(OutBandwidth),(sum(In_Averagebps)/sum(InBandwidth)) * 100,

      sum(Out_Averagebps/OutBandwidth)+sum(In_Averagebps/InBandwidth)*50))) AS AVERAGE_of_CircuitUtil_AvgRecvXmit2

      RESIDENT InterfaceTrafficDetailTemp

      GROUP BY InterfaceID, NodeID,In_Averagebps,Out_Averagebps,InBandwidth,OutBandwidth,InterfaceName,BandwidthandCircuit;