Simran Kaur Kahlon
Simran Kaur Kahlon

Reputation: 41

Query Dynamodb using columns other than partition and sort keys

I have a dynamodb table named "client" with the following columns : - userId(partition key) - clientId(sort key) - status(true/false).

I would like to get all the records from the "client" table with status="true" using node.js.

Upvotes: 0

Views: 925

Answers (1)

OmryRo
OmryRo

Reputation: 86

You can't query without a key.

if you want to query by status, you will have to create a secondary partition key on the 'status' column (which, you have to pay more for using it like everything else in AWS).

but unless you will discard some of the columns from the projection (result) that you don't need, it won't be any much faster than using full scan on the table, because state contain only two values...

you can read about it in https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-indexes-general.html

Upvotes: 2

Related Questions