Pros and cons of sorting data in DB?
- by Roman
Let's assume I have a table with field of type VARCHAR. And I need to get data from that table sorted alphabetically by that field.
What is the best way (for performance): add sort by field to the SQL-query or sort the data when it's already fetched?
I'm using Java (with Hibernate), but I can't tell anything about DB engine. It could be any popular relational database (like MySQL or MS Sql Server or Oracle or HSQL DB or any other).
The amount of records in table can vary greatly but let's assume there are 5k records.