AWS DynamoDB最大项目大小
我正在尝试使用DynamoDB创建一个简单的记录系统。使用此简单的表结构:
{
"userName": "Billy Wotsit",
"messageLog": [
{
"date": "2022-06-08 13:17:03",
"messageId": "j2659afl32btc0feqtbqrf802th296srbka8tto0",
"status": 200
},
{
"date": "2022-06-08 16:28:37.464",
"id": "eb4oqktac8i19got1t70eec4i8rdcman6tve81o0",
"status": 200
},
{
"date": "2022-06-09 11:54:37.457",
"id": "m5is9ah4th4kl13d1aetjhjre7go0nun2lecdsg0",
"status": 200
}
]
}
很容易将消息日志中的项目数输入成千上万。
根据文档,“项目”的最大大小为400kb,这严重限制了可以存储的日志元素的最大数量。
在不诉诸于更传统的SQL诉讼的情况下,将存储此数量数据的正确方法是什么(实际上并不需要)
I am trying to create a simple logging system using DynamoDB. Using this simple table structure:
{
"userName": "Billy Wotsit",
"messageLog": [
{
"date": "2022-06-08 13:17:03",
"messageId": "j2659afl32btc0feqtbqrf802th296srbka8tto0",
"status": 200
},
{
"date": "2022-06-08 16:28:37.464",
"id": "eb4oqktac8i19got1t70eec4i8rdcman6tve81o0",
"status": 200
},
{
"date": "2022-06-09 11:54:37.457",
"id": "m5is9ah4th4kl13d1aetjhjre7go0nun2lecdsg0",
"status": 200
}
]
}
It is easily possible that the number of items in the message log will run into the thousands.
According to the documentation an "item" can have a maximum size of 400kB which severly limits the maximum number of log elements that can be stored.
What would be the correct way to store this amount of data without resorting to a more traditional SQL-approach (which is not really needed)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有关您的数据用例的一些信息将有所帮助。我的主要问题是
在不知道您的数据读/写入模式的更多信息的情况下,更好的布局是让每个日志条目成为DB中的一个项目:
使用上述结构,您可以在日志条目中微不足道地附加&假设您已将其设置为适当的用例,则可以有效地检索它们。专注于了解排序键和辅助索引如何优化DB中的条目。您想避免在整个数据库中扫描寻找您的项目。请参阅有关更多信息。
Some information on use cases for your data would help. My primary questions would be
Without knowing any more info on your data read/write patterns, a better layout would be to have each log entry be an item in the DB:
With the above structure, you can trivially append log entries & retrieve them efficiently assuming you've set your sort key / indexes appropriately to your use case. Focus on understanding how the sort key and secondary indexes optimize finding your entries in the DB. You want to avoid scanning through the entire database looking for your items. See Core Components of Amazon DynamoDB for more info.