1
votes

I have been reading about DynamoDB hash, range keys and indices. My use case is simple, but I'm already confused.

I want to store 3 values:

  • event ID
  • event timestamp
  • article ID

Essentially, this means an article ID was accessed on the timestamp. Event ID uniquely identifies the event, and should allow for now duplicates.

I guess this suggests event ID should be my primary key?

But I will always query using article ID and timestamp.

My only idea is event ID = primary key with article ID and timestamp being secondary indices. But is that optimal? Thank you!

1

1 Answers

1
votes

A Global Secondary Index can be setup on article Id & timestamp and queries performed against the created index for better read performance.