DynamoDB structure recommendation

13 views Asked by At

I have the following data that will be put into a dynamoDB - the context is that we will be deploying a script to computers to pull the information below, so in theory serial number will be globally unique, updateTime will be a locally generated timestamp. the other values can and will be duplicated

"serialNumber": {
    "S": "3"
  },
"updateTime": {
    "S": "3-2-2024"
  },
  "username": {
    "S": "admin"
  },
  "password": {
    "S": "password"
  },
  "workstationName": {
    "S": "Dell"
  },
  "companyName": {
    "S": "Comp1"
  }

my access patterns are:

need to search by 3 criteria (serialNumber, workstationName or companyName), sometimes only knowing 1 criteria

I have thought about making a composite key of a static value and then the range key would be the serial number

[DynamoDBHashKey("PASSWORDINDEX")]
        public string PASSWORDINDEX { get; set; } = "PASSWORDINDEX";

[DynamoDBRangeKey("serialNumber")]
        public string SerialNumber { get; set; } = string.Empty;

with then 2 LSIs for workstation and companyName

I understand I need a composite key so I can use LSI, but I won't always use the sort key of Serial number

Unsure though if a static parition key would hurt data from being distributed evenly or if there is a better way to think about this

Can someone give some guidance for me? I am expecting 1,000 records in this database so not terribly large. The read access will be fairly infrequent and light when needed

0

There are 0 answers