I am trying to wrap my head around how I should create a table in DynamoDB. I need a table Subscription
that stores the items for each subscription the company has. Therefore, I planned the following attributes.
- SubscriptionId
- Companyid
- Startdate
- Endate
- Productid
I read a lot about how indexing works in DynamoDB with respect to secondary indexes, but I'm really struggling to figure it all out. It seems that the more I read, the more confused. I understand the basic concepts of global secondary indexes and local secondary indexes, as well as the hash key + range key. The problem is to put it all together and develop a table that supports my query requirements.
I currently have the following query requirements:
- The ability to request active subscribers for this company. That is, a request
CompanyID
and a comparison StartDate
and EndDate
a predetermined date - The same as above, except for the request, to find out if this company has an active subscription for a certain
ProductID
In the future (or now) I would like to be able to request all active subscriptions for this ProductID
. My initial plan was to use SubscriptionID
both a hash key and CompanyID
as a range key for efficient requests for a given company subscription. However, I'm not sure if it is even possible to request a range key? I know that the combination of a hash key and a range key is unique (composite key), but is it always necessary to include a hash key when performing a search for a range key?
StartDate
EndDate
, , , , ( )? , , .
, , - / , / /. , . , - , , , , .
, , . , - . :, , ?