Filter, Item counts and Limit

Actual item size is used for calculating the consumed RRU. In other words, you will not save on IO cost by using filter or limit.

Filter

Both scan and query api allows filter expression. The idea of a filter, is to restrict the returned items by way of filter expression that is applied to the non-key attributes in the fetched items. Think of it as the SQL WHERE clause applied to non-key attributes. Benefit is that it leads to better performance and less work for the application.

filter

Item Counts

Scan and query API receives 2 types of item counts in the response

  • ScannedCount is the count of items before the filter criteria is applied.

  • Count is the number of items received by the application in the result set.

These counts will give you an idea about the cost and efficiency of the query.

item-counts

Limit

Applications can limit the number of items received in the scan and query calls. This is done with the LIMIT parameter. In the illustration below an application is calling query operation with Limit =3, as a result DDB will return only the first 3 items from the item collection.

limit