1
votes

Let's say we have a DynamoDB record with Primary Key: A1 and GSI (Hash Key: B1 and RangeKey: C1).

And we have the following records in the database:

A1        B1        C1
--------------------------
value1    value2    value3
value4    value5    value6

Now, I want to query a record with Primary Key A1 with value value1 and update the same A1 attribute to value7.

If we can do this, what is the impact on other partitions. Will we run into any issues if we do it like this?

Does this have any impact on the table? Given we operate at a large scale.

1
I didn't get what you mean by this "And we have the following records: A1 B1 C1 value1 value2 value3 value4 value5 value6". Are "A1 B1 C1" keys or values? - jellycsc
@jellycsc I have updated the question - Anirudh Mergu
Thanks, another clarification, what kind of impact on the table are you asking? - jellycsc
If we can do this, what is the impact on other partitions. Will we run into any issues if we do it like this? - Anirudh Mergu
Of course not, I personally don't see any reason or major impact on why you can't do this. - jellycsc

1 Answers

2
votes

You cannot do this.

You cannot use UpdateItem to update any primary key attributes. Instead, you will need to delete the item, and then use PutItem to create a new item with new attributes.

From: Amazon DynamoDB API Reference AttributeValueUpdate

By creating new item, obviously there will be no tragic implications.