Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Performance in ORDER BY

Performance in ORDER BY

From: jabelsc <jabelsc_at_gmail.com>
Date: 22 Sep 2005 08:20:44 -0700
Message-ID: <1127402444.410545.185980@g14g2000cwa.googlegroups.com>


Hello everybody!!

  We have a SELECT running over our database. We only need several registers of a table of 800.000 values. In the SELECT when we put in comments the ORDER BY T.START_TIME DESC line, the instruction is executed in 7 seconds, but if we use the ORDER BY line, the execution goes to 8 minutes.

  I would appreciate any tip very much, cos I am desperate with it.

  Thanks in advance.

 Abel S.

      SELECT CCID,GROUP_ID, ....(other fields)
      FROM (
        SELECT S.CCID, S.GROUP_ID, ...., ROWNUM AS RN
        FROM SITEINFO S,TIMESTMP T, ADDEF A, UNIT U
        WHERE A.TYPE ='DI' AND  T.STATUS = 'C'  AND  T.USER_ID IS NULL
AND S.CCID = T.CCID AND S.GROUP_ID = T.GROUP_ID AND T.FUNCT_NUM = A.FUNCT_NUM AND U.FUNCT_NUM = T.FUNCT_NUM AND T.VALUE_NO = A.VALUE_NO
        ORDER BY T.START_TIME DESC
      )     
      WHERE RN BETWEEN 4051 AND 4125;
Received on Thu Sep 22 2005 - 10:20:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US