3

We need to query a large (2TB+) DynamoDB table to get multiple items based on their partition keys.

We are planning to use PartiQL as it supports the IN operator as such:

SELECT * FROM table_test where pk IN ('1234','1112');

Would this query do DynamoDB query operations or DynamoDB scan operations under the hood?

We would like to avoid table scans due to them being more expensive.

Ermiya Eskandary
  • 15,323
  • 3
  • 31
  • 44
mariz
  • 509
  • 1
  • 7
  • 13
  • 1
    Not a direct answer, but still good to know: you can block PartiQL statements that result in a scan at the IAM level ([source](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-iam.html)). It's a good safeguard against regressions. – MikaelF Aug 19 '22 at 01:46

1 Answers1

3

Would this query do DynamoDB query operations or DynamoDB scan operations under the hood?

It will be doing multiple DynamoDB queries as your WHERE clause condition statement is filtering on a DynamoDB partition key.

This is confirmed as per documentation:

To ensure that a SELECT statement does not result in a full table scan, the WHERE clause condition must specify a partition key. Use the equality or IN operator.

Ermiya Eskandary
  • 15,323
  • 3
  • 31
  • 44