Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2011
    Posts
    7

    Unanswered: Performance Issue

    While running the below query ,the query is taking time during execution. As i want the tsi_pos_num attribute in Desc order, i am giving the ORDER BY clause in the inner query. Any suggestion on how to make it faster?

    SELECT *
    FROM
    (SELECT rownum rnum,
    TABLE_NAME.*
    FROM
    (SELECT ID
    FROM TXN_STLMNT_INSTR
    WHERE
    (
    tsi_pos_typ = 25
    AND sqnc_num > 0
    )
    ORDER BY tsi_pos_num DESC)

    TABLE_NAME
    WHERE rownum <= 99)
    WHERE rnum > 0
    ORDER BY
    tsi_pos_typ desc,
    sqnc_num ASC

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    post EXPLAIN PLAN
    Code:
    SELECT * 
    FROM   (SELECT ROWNUM rnum, 
                   table_name.* 
            FROM   (SELECT id 
                    FROM   txn_stlmnt_instr 
                    WHERE  ( tsi_pos_typ = 25 
                             AND sqnc_num > 0 ) 
                    ORDER  BY tsi_pos_num DESC) table_name 
            WHERE  ROWNUM <= 99) 
    WHERE  rnum > 0 
    ORDER  BY tsi_pos_typ DESC, 
              sqnc_num ASC
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •