Efficient way to fetch data from server using GraphQL (avoiding pagination)

0

Context: My app needs to load data from a 'Users' table on the backend. In order to do this, when User-X signs in, I make GraphQL calls to that table to find the user.

Problem: Amplify only checks 1000 records at a time. If it finds User-X in the first 1000, it will return me his data. If not, I have to make another API call to the server, and look for User-X in the next 1000 records. And so on.

Reference: https://docs.amplify.aws/lib/graphqlapi/query-data/q/platform/android/#list-items

Why this is a problem: Paginating in this way via multiple API calls to the back is obviously not optimal, since the latency of my app will increase proportionately to my userbase.

Question: I am sure there must be a more efficient way to do this. Any thoughts?

1개 답변
0

Take a look at this article: https://aws.amazon.com/graphql/graphql-dynamodb-data-modeling/

A lot has to do with table design, single vs. multi-table. Pagination is not a bad thing, especially for mobile or web clients who may not scroll through 1000's of record. I would make the pagination parameter configurable, do some testing based on how the client uses the front end. If this is an analytics apps, then a relational app with more complex SQL might be better.

profile pictureAWS
Roly
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠