0

我正在尝试为我正在从事的项目编写邀请系统。我计划有一个“给我们你的电子邮件地址,我们会在我们准备好时给你一个测试版邀请”类型的东西。我试图弄清楚如何设计一个 DynamoDB 表,以便我可以查询尚未收到邀请的前x 个用户。

我正在考虑创建的表将具有以下几列:

  • 电子邮件
  • 日期
  • 已完成(布尔值)

我可以使用 DynamoDB 中的哈希键、范围键和二级索引的某种组合来执行此操作吗?还是这更适合 SQL 数据库?SQL 查询将是这样的:

SELECT email
FROM invite_request
WHERE fulfilled = 0
ORDER BY date
LIMIT 50;
4

1 回答 1

0

Your best option here is to use the hash key as Fullfilled or Unfullfilled. That way you can use the query method which is much less expensive than scan. So your record would look like:

:Hash_key => Boolean , :Range_key => DateTime , Attributes => [email=>value]

Using this structure you can query all unfulfilled emails within a certain date range and limit the results. Hope this helps. If you want more access to the information for later you may want to look into SimpleDB as a better option, but if you're only using this for a single function Dynamo is a great way to go.

于 2013-07-24T19:48:20.043 回答