Home > Software design >  Does the IN PartiQL operator query or scan DynamoDB tables?
Does the IN PartiQL operator query or scan DynamoDB tables?

Time:05-08

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.

CodePudding user response:

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.

  • Related