Table scans and queries

But what if we find ourselves in a situation where we are unable to determine the correct key to use to retrieve the data? Then, we can use a table scan. A scan operation is simply an operation that will essentially read all the items from the table, starting with the first item and then continuing with the next until it has read through all the items in the table. With a table scan, we can retrieve all the attributes stored in all the items, or we can perform filtering on the data with a filtering expression to match only the data you are looking for. 

Scanning and then filtering, however, is inefficient. We always get charged for the whole scan, even if the data returned is highly filtered. This is why we should always try to perform the operation as a query. For a query, we will need to supply the primary key and an operator to be run against the sort key. For example, if we are only retrieving a certain date range from the sort key for our user logging in, we can construct a query with the date range, and the data-retrieval process will find the appropriate items on the server and return them in the response. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.171.125