DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Order by DESC took twice as long than ASC

  1. #1
    Join Date
    Dec 2000
    Posts
    75
    Is it becuase Oracle always default sorting on ascending order?
    goodhealth

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Do you have an index in ascending order on the column?
    Jeff Hunter

  3. #3
    Join Date
    Oct 2000
    Location
    Cambridge, MA (Boston)
    Posts
    144
    Oracle does not guarantee ordering (attribute of RDBs), however your data may already be ordered. I suggest you do some explain plans and/or select out selected rows (or the whole table if small enought) to see if the rows were loaded in order.

    d.

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    There might also be other reasons for this.

    If for example you have a GROUP BY in your query then it might not perform an aditional sorting for ORDER BY ASC at all, because ascending sorting is implicitly performed on GROUP BY. But if you have ORDER BY DESC on top of GROUP BY it mut perform an additional sort, hence longer execution time.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

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


Click Here to Expand Forum to Full Width