SQL Performance (MOSC)

MOSC Banner

Data Ordering/Sorting Behavior in Oracle Using Group By and/or Order By

edited Sep 9, 2019 4:52PM in SQL Performance (MOSC) 3 commentsAnswered

This thread is for discussion and questions about sorting data in Oracle with or without using Group By and/or Order By  clauses.

General Advice:

  • A change in behavior in 10g and higher releases is explained in the note: GROUP BY Clause Does Not Guarantee a Sort Without ORDER BY Clause in 10g and Above (Doc ID 345048.1). This confirms that The GROUP BY clause does not guarantee that the output will be sorted by the grouped columns and does not guarantee the order of the result set. To order the groupings, use the ORDER BY clause.  If no ORDER BY clause is specified, then the order of the rows retrieved depends on the method used to retrieve the rows from the database.  In other words, it depends on the execution plan chosen.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center