如果发射页面有限,从发电机DB获取后续页面的机制是什么

发布于 2025-02-03 03:23:39 字数 1046 浏览 2 评论 0原文

我正在使用dynamodBenchancedAsyncclient用于查询dynamodb使用gsi分页。以下是我用来实现相同的代码。我正在尝试使用limit()sdkpublisher< page< customer> gt;

Flux.from(PagePublisher.create(query.limit(5)).items())

我计划提供下一个后续后续的 sdkpublisher< page; page< page;使用lastEvaLeTKeyexclusivestartkey docs >我的疑问是,当我们使用limit()限制页面数时,到底发生了什么,从dynamodb中实际获取的页面数字?

  1. 都是可以适应1MB per queryResponse的所有页面 限制是从dynamodb中获取的,然后只有页面 limit()后允许发送回?
  2. 仅页数 limit()允许从DynamoDB获取?

如果其#1。那么,不是从DDB再次获取页面的开销或额外的冗余努力,因为较早的页面已经被获取了,并且我们只是使用expusivestartkey再次获取它们?

I am using DynamoDBEnchancedAsyncClient to query DynamoDB using GSI and pagination. Below is the code that I am using to achieve the same. I am trying to limit the number of pages emitted to the client using limit() below in the SdkPublisher<Page<Customer>>

Flux.from(PagePublisher.create(query.limit(5)).items())

I am planning to provide the next subsequent pages to the client back using the lastEvaluatedKey and exclusiveStartKey mentioned at Docs > My doubt is when we limit the number of pages using limit(), what exactly happens wrt the number of pages actually fetched from the DynamoDB?

  1. Are all the pages that can accomodate the 1MB per queryresponse
    limit are fetched from DynamoDB and then only the pages that are
    permitted after limit() are sent back?
  2. Only the number of pages
    permitted by limit() are fetched from the DynamoDB?

if its #1. Then wouldn't it be overhead or additional redundant effort of fetching pages again from the DDB, since the earlier pages would have been already fetched and we are just again fetching them using exclusiveStartKey?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜光 2025-02-10 03:23:39

限制是在DynamoDB内评估的,并且您不收取访问超出指定限制的项目的费用。

如果您需要从DynamoDB中获取多个数据,则您的工作是跟踪返回的总项目,限制仅适用于单个请求。如果您的限制为500,并且数据的第一页返回400个项目,则在发布第二个请求时,应将限制降低到100。

如果要为最终用户实现分页并希望提供特定的页面大小,则您可以使用限制,然后继续使用该限制值以在后续请求中使用。您将为每个请求提供许多限制的项目。

Limit is evaluated inside DynamoDB and you are not charged for access to items beyond the specified limit.

If you need to get multiple pages of data from DynamoDB, it is your job to track the total items returned, limit only applies to a single request. If you have a limit of 500, and the first page of data returns 400 items, when making the second request you should reduce your limit to 100.

If you want to implement paging for your end user and want to supply a specific page size, you can use a limit and continue using that limit value for subsequent requests. You will get a number of items up to that limit for each request.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文