amazon-dynamodbamazon-dynamodb-index

DynamoDB: New SGI index for existed table with empty value for sorted key


I understand that the String key attribute of global secondary indexes requires non-empty values, so attempting to put an item with an empty sort key will fail. However, what will happen if a GSI is created on an existing dataset where some items have an empty value for the attribute that is now the sort key?


Solution

  • I assume when you say empty you mean an empty string "".

    You will get an exception when creating the index, as it can't index on empty values.

    Should the value not exist, then the index will create fine and just not include those items (sparse index)