Search

What is the difference between order by and sort by in hive?



  • SORT BY will sort the data within each reducer. We can use any number of reducers
    for SORT BY operation.
  • ORDER BY will sort all of the data together, which has to pass through one reducer.
    Thus, ORDER BY in hive uses single reducer.
  • ORDER BY guarantees total order in the output while SORT BY only guarantees
    ordering of the rows within a reducer. If there is more than one reducer, SORT BY may give partially ordered final results