Consider showing the user some tabular data and letting them sort it based on the different fields

Client side sorting:

  • All the data has to be sent over the network to the client, so for a large amount of data the initial load time will be high
  • Consecutive sorts would be super fast as data is already available
  • There are also limitations on the amount of data the frontend can efficiently sort. Client devices are computationally weaker and have fewer resources than servers.

Server side sorting:

  • Only the necessary data has to be sent over the network, thus reducing initial load time (given the request is paginated)
  • Servers have high computational power and enough resources to efficiently sort data
  • Consecutive sorts would be longer than in case of client side sorting as network calls have to be made to the server

Can we use IndexedDB to overcome the shortcoming of client-side sorting?

  • No, while IndexedDB offers storage for a large amount of data, it does not have internalised sorting, meaning the frontend has to do the sorting
  • Thus sorting would be language specific and might not be consistent
  • The data also has to be loaded from the DB onto memory, this again introduces a limitation on the data size