Reputation: 8697
I'm wondering if there is any performance difference between the following cases:
Case 1
{
id: 1,
backgroundColor: 'red',
font: 'Arial'
}
Case 2
{
id: 1,
style: {
backgroundColor: 'red',
font: 'Arial'
}
}
I prefer the structure of the 2nd case: item.style.font
. Does it have any disadvantages in comparison to the 1st case?
Furthermore:
does it make a difference to use shortcuts (bgColor
instead of backgroundColor
) or is DynamoDB generating hashes anyway?
Thanks in advance!
Upvotes: 1
Views: 43
Reputation: 1053
There are big differences between them:
You can create an index only with top level properties. So if you want to put an index on font
, you should go with solution one.
Dynamodb doesn't hash property names. So the name of your properties impact directly the size of your item. However keeping meaningful names is important. So don't reduce property names too much...
Concerning Scan & Query filters, you can create conditions on sub-properties.
Take a look at this page : http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html. It contains useful information.
Upvotes: 1