Should data sorting be done on the client or on the server?

前端 未结 4 575
刺人心
刺人心 2021-02-05 09:39

I get data from a server and want to display it using GWT on the client.

GWT is not the problem here, you can replace GWT by Ajax calls or you can transpose it to a real

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 10:08

    One should be careful of an all-inclusive statement that it is ALWAYS faster to sort on the server than on the client. I had a case where I was returning several thousand records sorted by the concatenation of the last name and first name. Neither one of these fields were indexed and I had no control over this. As we know, sorting concatenated strings is not something the database does well intrinsically. It looks numbers and/or indexed fields. Sorting on the client in this case ended up being faster. If I had the control over the database, I would have placed a function index in Oracle on these two fields.

    The moral of the story is to ASSUME NOTHING and profile your application to find out what works best for your scenario.

提交回复
热议问题