- I have a traditional endpoint
/foo
which has search params, pagination params, and sorting params. - This
foo
has attributes likename
,date
,xyz
, etc. Most of these parameters are present as columns in the db table which backs the entity. Providing pagination, sorting, and searching for these attributes is pretty well supported by my framework (spring-data-jpa). - Some other attributes are complex calculations and aggregations which require data from other tables.
How do I provide pagination, sorting and searching based on these attributes if I cannot rely on SQL to do it ?
- I could load the entire table in memory and compute all the required values and then provide searching, pagination and sorting myself...
- Roll up my sleeves and write some fairly involved SQL...
Are there any other options/better ways to do it ? I feel like this might be a fairly common problem.