There is a REST (like) API that returns a list of results. The results are obtained from the SQL query. It is necessary to implement paging, i.e. the ability to return only a certain number of items from the requested.

The solution "in the forehead" - every time to fulfill the request and read the necessary records from the cursor, it works extremely slowly.

Caching results in the API and storing until the next call violates the principle of statelessness.

What other approaches to the implementation of this functionality can be advised?

Database - PostgreSQL.

  • Hmm, and the SQL query itself to adapt? Limit the number of results? - Peter Slusar
  • Type SELECT * FROM data_set WHERE name = 'test' LIMIT 10; ? - Peter Slusar
  • The problem is the absence of a unique key. So the first 10 entries can be returned, but the next 10 - no longer. - spoonboy
  • The question is not the modest api itself on jave? I will clarify the idea that sets can iterate over records while maintaining state ... - Peter Slusar
  • On Mule / RAML. - spoonboy

0