Fork me on GitHub
#aws
<
2021-12-20
>
Drew Verlee03:12:28

In dynamodB where do you draw the line between indexing and run time filtering? It seems like you could push everything into a key-value relationships if you index aggressively enough. http://2.in DynamoDB a GSI is hydrated off the main table, does that mean when you do an insert into the main table you have to add the attribute to that insert that is used as the PK of the GSI? e.g use case. I have users in a class So my primary table pk is class#uuid:user#uuid and then use the query "starts_with" argument if i wanted all users for a class? But what If i wanted to quickly pull all users that were in a specific set of class how would i do that as efficiently as possible? I'm thinking the pk on the GSI would be class-1#<uuid>:class-2#<uuid>:user#uuid and then when i inserted records it would look like insert into class table attributes: • pk -> class#123 • users -> [...] • class-1#123:class-2#abc:user#a -> user info • class-1#123:class-3#abc:user#a -> user-info ... One record for each secondary class they took so they all get updated. Then i can do the same thing i did with my primary table when i wanted all users that took those 2 classes and use "starts_with" e.g starts_with(class-1#123:class-3#abc) I'll assume i always ask for classes in a sorted order to so they are always in the same order. Does that seem right?