Best practice - defining partition and sort keys #207
-
I noticed the following differences when calling update operations on an entity, based on how I defined a sort key for a GSI index: All update operations I run work with the below code as long as I pass
This behavior changes once I change the following lines to
Now when I try to update just
And of course if I just want to update
The first approach makes updating key attributes much easier (for 2nd approach, if I want to update either clientId or dept, I always have to supply them together). I can also query
I can also do the same with the 2nd approach, just the BEGINS_WITH conditions would have to begin with My question is what approach makes more sense? Is the behavior I describe expected? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @michael-pont, Sorry for the late response. The first approach is preferred because it will provide you with the most flexibility when updating data, while also letting you query the departments for a given client. The second approach will always require you to pass in all the referenced params when updating. |
Beta Was this translation helpful? Give feedback.
Hi @michael-pont,
Sorry for the late response.
The first approach is preferred because it will provide you with the most flexibility when updating data, while also letting you query the departments for a given client.
The second approach will always require you to pass in all the referenced params when updating.