Pagination or no pagination

Hi i cant decide to whether implementing pagination or not.
I understands that pagination serves the client a subset of data to offload the computing of the backend. While this is great when x amount of client are request data from a table. The problem lies when they need to do the filtering, the filtering only happens on the subset instead of on the whole table. So if the table consist of 1000 records and the subset is 10, filtering only happens on the 10 records. Do i have to implement a call to the backend for each every filtering that being applied? does this just lead to more database calls? So what is best serving the client a bigger set of data so the filtering can happens client-side or do the filtering on the backend side and ends up with more calls to the backend Thanks in advance
8 Replies
mg
mg2w ago
filtering, sorting, and pagination should all be done on the backend that's WHERE, ORDER BY, and OFFSET/LIMIT, respectively 1:1 with your database
Qu-nii-sama
Qu-nii-samaOP2w ago
Wouldnt that increase the cost of the usage of database?
mg
mg2w ago
not really
Angius
Angius2w ago
Well, there's no other way, really
mg
mg2w ago
databases are built to do those things and yeah, what's the alternative
Angius
Angius2w ago
Filtering and sorting must be done on the whole table Either you do it database-side, or you load everything into the client The former is preferable
mg
mg2w ago
this. sure, it's marginally more computation on the database, but it's way less bandwidth being used between the database, backend, and client
Qu-nii-sama
Qu-nii-samaOP2w ago
aight then i guess paginations it is then , and then implement database filtering on each properties And thank you guys for sparring with me
Want results from more Discord servers?
Add your server