Amazon DynamoDB highlights

Amazon DynamoDB highlights

When working with DynamoDB you need always to think about the following things:

  • primary key or partition key (is more appropriate naming for this) is actually a hashkey, that is used to determine correct partition to store record,
  • sort key (optional) is an additional key to form compound key together with primary key and to sort records when making queries,
  • scan is performing full table search on all partitions, that is a very expensive operation,
  • when search with a condition on attribute without GSI (global secondary index) or LSI (local secondary index) is used, you can only make a scan,
  • if scan is used you cannot sort records by any attribute - records will be always returned in random order,
  • LSI (local secondary index) is actually the same as sort key in a table,
  • query operation is always performed on particular partition key and additional conditional filtering is possible on sort key or LSI attribute,
  • if you are willing to use LSI, you need to create a table with HASH and RANGE key in advance (partition key and sort key),
  • GSI is actually just a new table with defined primary key and sort key (optional) - base table primary key is always projected into an index,

Some practical links to look at:

  • https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html

Jeff Barr Can you, please, have a look? Am I missing some important things?

Like
Reply

To view or add a comment, sign in

More articles by Eugene Goncharuk

Explore content categories