Database Reference
In-Depth Information
Query versus scan
Even though the query and scan operations are meant to get bulk data depending on the
given criteria, there are lots of fundamental differences between these operations. From a
performance point of view, a query is much more efficient than the scan operation, as a
query works on a limited set of items, while the scan operation churns the entire table data.
The scan operation first returns the entire table data and then applies filters on it to remove
the unnecessary data from the result set. So, it's obvious that as your table data grows, the
scan operation would take more time to give back the results.
The query operation's performance is totally dependent on the amount of data retrieved.
The number of matching keys for a given search criteria decides the query performance. If
a specific hash key has more matching range keys than the size limit of 1 MB, then you can
use pagination where an ExclusiveStartKey parameter allows you to continue your
search from the last retrieved key by an earlier request. You need to submit a new query re-
quest for this.
Query results can be either eventually consistent or optionally strongly consistent, while
scan results are eventually consistent only. The capacity unit calculation for query and scan
is similar to other operations in DynamoDB, which we have already seen.
Search WWH ::




Custom Search