I have to design a DynamoDB table for a Monitoring System.
The attributes present for each item are:
name
(Monitor Name: String)et
(milliseconds epoch: Number)owner
(Owner of the monitor: String)
Below are the queries that I need to perform:
- Retrieve all monitors:
1.1 That ran today
1.2 Inet
(milliseconds epoch) range - Retrieve by
owner
andname
- Retrieve by
owner
- Retrieve by
owner
,name
, and inet
(milliseconds epoch) range
I came up with below selection of keys:
- Partition Key: Owner#MonitorName
- Sort Key: ET (milliseconds epoch)
- GSI Partition Key: ET (milliseconds epoch)
How I think queries would be executed:
- Query 1:
- Query 1.1
et = :val
- Query 1.2
et between :val1 and :val2
- Query 1.1
- Query 2:
Owner#MonitorName = :val
- Query 3:
Owner#MonitorName begins_with(:val)
- Query 4:
(Owner#MonitorName = :val) and (et between :val1 and :val2)
Is this design efficient? What are the drawbacks for the design? How can it be improved?