AWS re:Postを使用することにより、以下に同意したことになります AWS re:Post 利用規約

DynamoDB - Indexing a list attribute

0

I have a dataset of call recording information, with fields/attributes including: Incoming Number, Dialled Number, Call Start Date, Agent(s) name. The end user will most likely want to search on Agent name, which is stored in a list attribute as there might be more than one. I can't add an index to a list attribute, so as a SQL dev I'm learning towards storing the agent ID in a different table and creating a many to many relationship between the two tables. However, Dynamo's a bit different so what's my best approach if I want to index the Agents attribute?

質問済み 2年前880ビュー
1回答
1

You're correct that you would not normally create "join" scenarios for DynamoDB. Typically you would have an individual item for each Agent:

PKSKotherother-1
01202333444C#012023334441/1/2023Call metadata
01202333444Bob1/1/2023Data
01202333444Michelle1/1/2023Data
01202333444Lee1/1/2023Data

In DynamoDB and other NoSQL databases its common to de-normalize the data, which takes a little bit of getting used to coming from a relational database background.

profile pictureAWS
エキスパート
回答済み 2年前
  • Thanks Leeroy

    I could denormalise to the following:

    Incoming Number StartTime PrimaryAgent SecondaryAgent 01202333444 1/1/2023 Bob Michelle

    but then, what happens if there's another agent?

  • I edited my answer to show how I would model the data

  • so, if I do a search for 01202333444, I'd get one record for each of the agents involved in the call, rather than just one record for the call?

  • Yes and you would also get the call metadata. The cost of reading does not change as you still pay up to the nearest 4KB.

  • not sure I like that, to be honest. A user would see two calls where there are actually only one, and this would confuse them. Thanks for your help though, Leeroy

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ