0

I have a dynamodb table includes 3 fields:

uuid: string
m: string
s: string
timestamp

the UUID is the partition key and timestamp is sort key. I need to build a function to take m and s as input and return uuid to users. In order to improve query performance, I am thinking to create a global secondary index to include m and s as partition key.

But I can't find a way to create a composite partition key. Do I have to use m as partition key and s as sort key for the global secondary index? What other solutions I can use?

1 Answer 1

0

If you’re always looking for an exact match of m and s; you can create a single partition key with is just those two concatenases together.

4
  • I am not always looking for m and s match. I need to show them separately. Commented Jun 17, 2020 at 11:54
  • You can still return the attributes m and s separately; but query on the concatenation.
    – Tom Harvey
    Commented Jun 17, 2020 at 12:07
  • so you mean create an additional one only for partition key? Commented Jun 18, 2020 at 5:40
  • Yes. It assumes that concatenation of M&S is unique though
    – Tom Harvey
    Commented Jun 18, 2020 at 8:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.