1
votes

I have created a DynamoDB table and a Global Secondary Index on that table. I need to fetch all data from the GSI of that table.

There are two options:

  1. Scan operation with No Filter Expression.
  2. Query operation with no condition.

I need to find out which one has better performance, so that I start my implementation.

I have read a lot about the DynamoDB Scan and Query operations but could resolve my query.

Please help me in resolving my query.

Thanks in advance.

Abhishek

1
There would be some primary key but I want to fetch the complete secondary index table. I can fetch the complete table using query or using scan. Which would give better performance.Abhishek Mittal
I know this is old and already answered, but how do you use scan without FilterExpression?anon999

1 Answers

1
votes

They will both impose the same performance overhead. So choosing either should be okay. You should think of adding optimizations on top of whichever approach you use - for instance performing parallel scans as mentionedin the best practices:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScanGuidelines.html

or caching data in your application

Do note that parallel scans will eat up your provisions.

Another thing to watch out for while making your decision would be, how likely is the query pattern going to change? Do you plan on adding filters in the future? If so, then query would be better since scan loads all the data (consuming provisioned read capacity) and then filters results.