Ashwin Dora
Ashwin Dora

Reputation: 115

DynamoDbScan Expression using aws-sdk java

I am using aws-sdk to connect with DynamoDb and I have got into a scenario where I got one dynamodb table with different partition/hash-key and I have to scan and filter to get the results. Scanning the entire table would be a costly operation . Is there a way to scan only a certain partion/haskey of a table ?

Upvotes: 0

Views: 268

Answers (1)

eL_Finito
eL_Finito

Reputation: 407

You have to use Dynamo DB Query. You can query any table or secondary index that has a composite primary key (a partition key and a sort key).

In my opinion you shouldn't use scan, because it very costly and slow.

You didn't write what is the program language, but here is some example to query:

About indices:

UPDATE #1:

Maybe that will help:

  1. Add a new column to your table. The values will be static. (For example: Col name: const_value Values: const)

  2. Create a new secondary index to your table.

    • 'partition key': 'const_value'
    • 'sort key': the column what you want to filter
  3. You can use Query.

aws-dynamodb

Upvotes: 2

Related Questions