全局二级索引:所有索引中的投影属性数超过 20 个限制



我正在尝试在具有 30 列的表上创建 GSI(使用 ruby SDK(。我使用projection_type:"ALL" - 但我仍然得到以下异常:

Aws::DynamoDB::Errors::ValidationException: One or more parameter values were invalid: Number of projected attributes in all indexes exceeds limit of 20, number of projected attributes:30

据我所知,这应该只在使用INCLUDE projection_type时发生:

此限制不适用于投影类型为 KEYS_ONLY 或 ALL 的二级索引。 http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-secondary-indexes

create 语句如下所示:

connection.update_table({
    table_name: "my-table", # required
    attribute_definitions: [
      {
        attribute_name: "indexDate",
        attribute_type: "S",
      },
      {
        attribute_name: "createdAt",
        attribute_type: "S",
      },
    ],
    global_secondary_index_updates: [
      {
        create: {
          index_name: "my-new-index", # required
          key_schema: [
            {
              attribute_name: "indexDate",
              key_type: "HASH",
            },
            {
              attribute_name: "createdAt",
              key_type: "RANGE",
            },
          ],
          projection: { # required
            projection_type: "ALL"
          },
          provisioned_throughput: { # required
            read_capacity_units: 10, # required
            write_capacity_units: 300, # required
          }
        }
      }
    ]
  })

事实证明,属性限制限制适用于表上的所有 GSI。我有另一个导致这个失败。删除了那个,然后它起作用了。

最新更新