r/JavaProgramming • u/p3t-code • Jul 15 '26
The performance issue in paging DB results - not a problem at all?
Hi everybody,
I am developing and maintaining a library for more efficient paging than the offset/size approach used by default in Spring's JDBC Repositories.
My main concerns are:
Fetching the total count with every page request can be quite expensive.
Fetching very high page numbers can be expensive as well, since the DB has to fetch all records before the requested page — just to discard them.
I developed this library in my free time to have a robust and flexible solution available, and we use it in a professionally developed cloud service.
Still, I get very little community feedback, so I'm wondering whether these problems are solved differently in other projects...
I'm curious! Please let me know if you have a good solution for these problems :-)