Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
 
friki data migration
Ranch Hand
Posts: 772
1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Avoid Java in-memory sorting for sort indirections

The SQL ORDER BY clause supports many types of expressions, including CASE statements, which can be very useful for sort indirections. For instance, if you want to order your shippings first by some of their status_codes, and only then by text, you can do this:



You should probably never sort data in Java memory because you think that


  • SQL sorting is too slow
  • SQL sorting cannot do it


  • The Cure:

    If you sort any SQL data in memory, think again if you cannot push sorting into your database. This goes along well with pushing paging into the database.

    Source


    SqlBestPractices
     
      Bookmark Topic Watch Topic
    • New Topic