2

I am new to dynamo db.

The table looks like below

| id   |rangekey |timestamp    |dimensions
| -----| --------|-------------|----------
| of1  | ACTIVE  |1631460979529|{"type":"test","content":"abc"}
| of2  | ACTIVE  |1631499979529|{"type":"test","content":"bxh"}
| of3  | ACTIVE  |1631499979520|{"type":"practice","content":"xyz"}
| of4  | ACTIVE  |1631499979528|{"type":"lecture","content":"lll"}
| of5  | ACTIVE  |1631460979927|{"type":"practice","content":"olp","component":"one"}
| ..   |..       |...          |...

so on.

The id is the partition key and range key is the sort key.The id values are unique.

It seems like poorly designed table when it comes to querying all the id for which the dimensions contains (or begins with)

"type":"test" or "type":"practice"

I am aware of the below approaches:

  1. Scan the table with filter expression like below

    contains(dimensions,'"type":"test"') or contains(dimensions,'"type":"practice"')
    
  2. Query the partition id one by one with filter expression as above.This seems like a problem because i have a large list of id (partition keys) approx up-to 5000 .But this could be run in parallel to reduce time

  3. Or can i create a dynamo db stream sort of a materialized view which has the view containing all id whose dimension is of type test or practice.Need more insight on this one.

Does any of the above approach seems good cost wise or efficiency.Are there better ways of doing this.Thanks in advance !

0 Answers0