amazon-web-servicesamazon-dynamodbdynamodb-queriespartiql

Does the IN PartiQL operator query or scan DynamoDB tables?


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.


Solution

  • 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.