How to query DynamoDB by date (range key), with no obvious hash key?
<p>I need to keep local data on an iOS app in sync with data in a DynamoDB table. The DynamoDB table is ~2K rows, with only a hash key (<code>id</code>), and the following attributes:</p>

<ul>
<li><code>id</code> (uuid)</li>
<li><code>lastModifiedAt</code> (timestamp)</li>
<li><code>name</code></li>
<li><code>latitude</code></li>
<li><code>longitude</code></li>
</ul>

<p>I am currently scanning and filtering by <code>lastModifiedAt</code>, where <code>lastModifiedAt</code> is greater than the app's last refresh date, but I imagine that will become expensive.</p>

<p>The best <a href="https://stackoverflow.com/questions/14836600/querying-dynamodb-by-date">answer</a> I can find is to add a Global Secondary Index with <code>lastModifiedAt</code> as the range, but there is no obvious hash key for the GSI.</p>

<p><strong>What is best practice when needing to query by range using a GSI, but there is no obvious hash key?</strong> Alternatively, if a full scan is the only option, are there any best practices to keep down the cost?</p>