skip to Main Content

Been having a hard time trying to find a definitive answer on this.

I need to mass insert a lot of data into a dyanmoDb table with a sort key (a DateTime). As far as I can tell, the order in which the data is inserted in unimportant, but I am trying to verify that.

If I need to insert a years worth of data for the same primary key, should it be done in a certain order, or does it not matter at all?

Thanks

2

Answers


  1. Mass inserting data with a sort key (a DateTime) in DynamoDB, the order in which the data is inserted is not crucial, as long as the sort key values are unique for each item. DynamoDB will automatically manage the storage and retrieval of the items based on the sort key values, regardless of the order in which they were inserted.

    Login or Signup to reply.
  2. The order DOES matter.

    If you want the benefits of "split for heat" then you’ll want to avoid an ever-increasing sort key. From https://aws.amazon.com/blogs/database/part-3-scaling-dynamodb-how-partitions-hot-keys-and-split-for-heat-impact-performance/

    Split for heat will only execute when it determines the split would be
    sufficiently beneficial based on recent activity. One common write
    pattern where split for heat would be determined not beneficial is
    when writing items with a certain partition key value and an
    ever-increasing sort key value (such as a timestamp), because no
    matter the chosen cut point, all new writes using that partition key
    will be on the second partition. This write pattern will limit the
    write activity to that partition key to 1,000 WCUs. If the sort key
    were random, splitting would be beneficial and thus a partition key
    could support unbounded WCUs.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search