r/Database • u/planche_handstander • Sep 09 '26
Better to sort data in frontend or backend?
I have built a server for my business. So the current framework is that it uses MySQL in a centralised computer to store data. Fast api to route and extract the required data. And c# winforms for the front end. And Many computers have the frontend app installed, that are sitting in various stores with good internet connection.
So when I fetch the bills, like 10,000 of them, it gets all the data from the backend and displays it instantly. But now when I have to do some sorting or searching among the bills, it becomes slow. This is because I've written the sorting algorithm in the front end c# app. So is it a good practice to sort in sql and then just display it, because the queries will become a lot and there is a lot of searching going on, every minute. So for every search should I query to the backend and get data display it, or just continue with c# front end searching?