Saturday, March 31, 2012

what is recomended to sort in the client side or in the database

I have a table of about 100 records, and i need it sort it before displaying it in a webpage, for stardard purposes and best practices I would like to know what is recomended, to sort this list in the client or in the database

A table of 100 records not very large. And you can do this withoutmuch overhead on the database server. But when your sorting withthousands or hundred of thousands records, this puts alot moreoverhead on the database server and then you will want to want to'sort' client side.

And grab only the columns you are using in the page and not all of them (*).

http://www.sql-server-performance.com/transact_sql.asp


In my opinion, the major consideration you should take into account is re-use.

If the the sort is presentation specific (i.e. in one web page you will sort the data one way, in another web page a different sort, and so on) then you will want the sort to be done in your presentation layer (.aspx page.)

However, if the data should be sorted in the same manner no matter what page is presenting the data, it makes more send to include the sort in your database query or stored procedure so you achieve consistency across all pages of your site displaying the data.

-Aaron

0 comments:

Post a Comment