Method: Dynamoid::Criteria::Chain#scan_limit
- Defined in:
- lib/dynamoid/criteria/chain.rb
#scan_limit(limit) ⇒ Dynamoid::Criteria::Chain
Set the scan limit.
The scan limit is the limit of records that DynamoDB will internally read with Query or Scan. It’s different from the record limit as with filtering DynamoDB may look at N scanned items but return 0 items if none passes the filter. So it can return less items than was specified with the limit.
Post.where(links_count: 2).scan_limit(1000) # => 850 models
Post.scan_limit(1000) # => 1000 models
By contrast with record_limit the cost (read capacity units) and performance is predictable.
When called without criteria it works like record_limit.
294 295 296 297 |
# File 'lib/dynamoid/criteria/chain.rb', line 294 def scan_limit(limit) @scan_limit = limit self end |