DynamoDB - Global Secondary Index on set items

后端 未结 3 2092
遇见更好的自我
遇见更好的自我 2021-01-03 22:08

I have a dynamo table with the following attributes :

  • id (Number - primary key )
  • title (String)
  • created_at (Number - long)
  • tags (St
3条回答
  •  情歌与酒
    2021-01-03 23:07

    • DynamoDB is not designed to optimize indexing on set values. Below is a copy of the amazon's relevant documentation (from Improving Data Access with Secondary Indexes in DynamoDB).

    The key schema for the index. Every attribute in the index key schema must be a top-level attribute of type String, Number, or Binary. Nested attributes and multi-valued sets are not allowed. Other requirements for the key schema depend on the type of index: For a global secondary index, the hash attribute can be any scalar table attribute. A range attribute is optional, and it too can be any scalar table attribute. For a local secondary index, the hash attribute must be the same as the table's hash attribute, and the range attribute must be a non-key table attribute.

    • Amazon recommends creating a separate one-to-many table for these kind of problems. More info here : Use one to many tables

提交回复
热议问题