Reputation: 93
I got the following table, I made a quick mock with a reduced set of attributes
I now have to solve these two access-patterns without a GSI, since I need the current real data from the table. GSI take some time to reflect the current values of the table.
My first access pattern is get all appointments within a certain date-range
My second access pattern is get all appointments by origin and originId
I can't use a GSI since I need to detect collisions for the the appointments by speakerId.
I'm using electro-db as an ORM which is why in the sk there is $... it's the collection name. Meaning I'm not able to store it like that 2024-02-02T08:00:00.000Z in the SK.
I could do a query and get all appointments for a speaker and filter the appointments afterwards. I think this isn't a great solution, since this would mean I'd load appointments from all the years even though they aren't required to detect if a collisions occurs.
For my access pattern where I want to load all the appointments by origin and originId, the querying all appointments for a specific set of items doesn't look right to me tott (I could solve that with a batchGetItem or a loop with getItem).
My issue is the access pattern for the collisions where I need to load all the appointments within a certain range.
Any hints how I could tackle this issue?
Upvotes: 0
Views: 35
Reputation: 93
I can get all the Items for a appointments by originId using a batchGet in combination with a backoff algorithm. The between with only using the composite key start as the start range and the end range by incrementing my composite start key by 1 day since dynamodb uses the lexicographical order. I'm still uncertain if thats the best way. Maybe someone got a better answer
Upvotes: 0