最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

database - How to provide pagination, searching and sorting for computed data? - Stack Overflow

programmeradmin1浏览0评论
  1. I have a traditional endpoint /foo which has search params, pagination params, and sorting params.
  2. This foo has attributes like name, 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).
  3. 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 ?

  1. I could load the entire table in memory and compute all the required values and then provide searching, pagination and sorting myself...
  2. 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.

发布评论

评论列表(0)

  1. 暂无评论