Skip to content

Conversation

@boostchicken
Copy link

This will allow you to limit the results returned from a DynamoDB query that has a sort and range key, techincally also a Scan. I developed this to reduce cost b ased on the new OnDemand pricing.

Example:

@Query(limit = "10")
List<Blah> findFirst10ByStatusAndDateTimeBeforeOrderByDateTimeDesc(String Status, String DateTime);

The previous behavior would actually return every single result and then clip it. With this limit parameter dynamo only returns the request amount of results. This is mainly for HashAndRange. It still requires First10 and the Query annotation to work otherwise the Spring-DynamoDB will just do queries limited to 10 results until it gets them all.

@boostchicken
Copy link
Author

image

A little look at how my query results return look based on this now. Also usage metrics are way down.

@codecov-io
Copy link

codecov-io commented Jan 12, 2019

Codecov Report

Merging #226 into master will increase coverage by 0.05%.
The diff coverage is 73.91%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #226      +/-   ##
============================================
+ Coverage     67.31%   67.36%   +0.05%     
- Complexity      656      658       +2     
============================================
  Files            83       83              
  Lines          2227     2246      +19     
  Branches        392      393       +1     
============================================
+ Hits           1499     1513      +14     
- Misses          549      553       +4     
- Partials        179      180       +1
Impacted Files Coverage Δ Complexity Δ
.../repository/support/DynamoDBEntityInformation.java 50% <ø> (ø) 1 <0> (ø) ⬇️
...y/query/DynamoDBEntityWithHashKeyOnlyCriteria.java 69.04% <100%> (+0.75%) 13 <0> (ø) ⬇️
...namodb/repository/query/PartTreeDynamoDBQuery.java 85.71% <100%> (ø) 10 <0> (ø) ⬇️
...epository/query/AbstractDynamoDBQueryCriteria.java 68.46% <100%> (+0.38%) 101 <1> (+1) ⬆️
...ynamodb/repository/query/DynamoDBQueryCreator.java 75% <100%> (+3.57%) 2 <1> (ø) ⬇️
...ery/DynamoDBEntityWithHashAndRangeKeyCriteria.java 74.3% <100%> (+0.14%) 74 <0> (ø) ⬇️
...db/repository/query/DynamoDBCountQueryCreator.java 44.44% <50%> (ø) 2 <1> (ø) ⬇️
...port/DynamoDBIdIsHashKeyEntityInformationImpl.java 72.72% <50%> (-2.28%) 9 <0> (ø)
...amoDBIdIsHashAndRangeKeyEntityInformationImpl.java 84% <50%> (-2.96%) 16 <0> (ø)
...repository/query/AbstractDynamoDBQueryCreator.java 49.05% <50%> (+0.03%) 11 <0> (ø) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbc97ec...958236c. Read the comment docs.

@boostchicken
Copy link
Author

boostchicken commented Jan 12, 2019

image

A look at GSI read metrics after deployment.

@derjust
Copy link
Owner

derjust commented Mar 10, 2019

Thank you so much.
Merged via #239

@derjust derjust closed this Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants