Suppose I have a type of table in which VARCHAR is typed. And I need to get data from that table that is sorted alphabetically by that area.
What's the best way (for display): Add order by field
to SQL-query or sort the data if it is already received?
i with hibernate using java, but i can not tell anything about db engine it is any popular relational database (such as MySQL or MS SQL server or Oracle or HSQL DB or any other) Could.
The amount of record in the table can be very different but assume that there are 5k records.
UPD: How well does the Hibernate cache (for example EHCache) support the sorted data at the second level? If this field is indexed, then the average DB will be more efficient in this work compared to Java.
Also keep in mind that you will not normally recover all those rows at one go, if it is for pure display, but instead retrieve a subset of it so that it can be shown to mark the page. You can do it at the DB level too. To sort the data in Java, it is necessary to place the entire table in the memory of Java, you do not want to do this.
In Hibernate you can order using results and using paging. E.g.
Comments
Post a Comment