title: How can I make a sparse index if the key is always required?
body: <p>I'm terribly confused by something in DynamoDB:</p>
  <p><a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForLSI.html#GuidelinesForLSI.SparseIndexes" rel="nofollow noreferrer">https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForLSI.html#GuidelinesForLSI.SparseIndexes</a></p>
  <blockquote>
  <p>For any item in a table, DynamoDB will only write a corresponding index entry if the index sort key value is present in the item. If the sort key does not appear in every table item, the index is said to be sparse.</p>
  <p>[...]</p>
  <p>To track open orders, you can create an index on CustomerId (partition key) and IsOpen (sort key). Only those orders in the table with IsOpen defined will appear in the index.</p>
  </blockquote>
  <p>But if you have an LSI defined with an alternate sort key, when you create new items, that alternate sort key can never be null. So therefore the index isn't sparse at all because every item I create will wind up in the index.</p>
  <p>What am I missing?</p>