I want to get all the items from table. Is query with GSI faster than scan ? I see Scan has parallel scan option but I don’t know how to implement it .

If I go with query with GSI . Do I don’t need to worry about performance issues?

Please let me know which is efficient way to get all items

1

There are 1 answers

0
Charles On BEST ANSWER

A query over a GSI would not be faster than a Scan() which works directly over the base table.

Unless you project all attributes to the GSI, you'd have to use GetItem() over the base table for every record returned by the GSI.

Even if you projected all attributes, Query() works only on 1 partition/hash key at a time.

If you have 100,000 unique partition keys in your GSI, your code would have to make 100,000 individual calls via query.