Comments (2)
Hi @mn-prp - thanks for reaching out.
I'm not able to reproduce it on my end and wanted to verify a few things with you. The expected behavior is that Limit
is used for non-pagination requests whereas pageSize
can be used when you want to specify results per page.
If you'd like to limit the total returned results, here's what I'd do:
const paginator = paginateScan(
{
client: DDBClient,
pageSize: 1,
},
{
TableName: tableName,
FilterExpression: 'begins_with(sk, :sk)',
ExpressionAttributeValues: {
':sk': sk
}
}
);
const LIMIT = 2;
let count = 0;
for await (const page of paginator) {
if (++count >= LIMIT) {
break;
}
}
}
Hope that makes sense but let me know if you have any further questions.
Best,
John
from aws-sdk-js-v3.
Thanks for looking into this. My use case is to retrieve all items, without any (final) pagination, since the goal of the query is to sum some values across the whole table for an internal analytics job that is run periodically.
I don't have the time to try to create a reproduction, since it obviously depends on a populated database, but I can comment on the context a bit. We have two environments, one staging and more production, and the staging environment has a table ~1mb in size, whereas production is ~5mb. The "total" values in both tables were known to be increasing, but whereas the staging environment did continue to increase, we noticed that the total of the production database query was stagnating at around some value (let's say 200,000 -- we were seeing totals at 210,000 then 209,000 then 197,000 then 201,000 etc.) This led me to think there was a page size that was being hit.
So I went and looked at the sdk call, which was the first snippet copied in my issue. By adding the Limit: 1000
I got the expected much-higher total. Then I tried Limit: 50
and again, the expected much higher value (but with many more network requests, as my logging showed). But when I removed the line, the value dropped back down to the ~200,000 and my logging revealed only one loop was being executed, with no LastEvaluatedKey
.
Is it expected that Limit
is required to read the full data set read from a multi-megabyte table? I would have expected that not setting Limit
would either (a) retrieve the max page size and return a LastEvaluatedKey
or (b) make the sdk continue fetching the next page automatically (and appending it to the result set so far) until there were no more pages.
from aws-sdk-js-v3.
Related Issues (20)
- Install size of node_modules increased in v3.565.0 HOT 4
- getSignedUrl Doesn't work with ContentDisposition param of PutObjectCommand HOT 7
- `DescribeSnapshotsCommand` mishandles empty array of filters HOT 2
- Version v3.569 results in TS2307: Cannot find module for @aws-sdk/lib-dynamodb HOT 2
- `@smithy/types` clients mistype `CloudFormation.describeStacks` HOT 2
- docs: use `pnpm add <pkg>` instead of `pnpm install <pkg>` HOT 5
- DynamoDB Client UpdateItemCommand -- Inaccurate Error Message HOT 2
- (short issue description) HOT 2
- Exception type document seems to be incorrect HOT 3
- (short issue description) HOT 1
- `waitUntilDBInstanceDelete` does not work HOT 1
- StartDirectoryListingCommand is missing from @aws-sdk/client-transfer HOT 2
- SDK Clients without Credential Providers HOT 6
- get the response header of PutObjectCommand HOT 1
- Exporting YAML OpenAPI spec with SDK Client GetExportCommand results in JSON spec HOT 2
- Not able to create and run a new Instance HOT 4
- The request must contain the parameter MessageHandle HOT 3
- Support for Header in SendEmail HOT 2
- What are the counterparts for types such as APIGatewayProxyEvent, DynamoDBStreamEvent etc. in v3? HOT 4
- Add possibility to retrieve savings plans inventory for the whole organization HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-js-v3.