Visit systemdesign.us for System Design Interview Questions tagged by companies and their Solutions. Follow us on YouTube, LinkedIn, Twitter, Medium.

https://d2908q01vomqb2.cloudfront.net/887309d048beef83ad3eabf2a79a64a389ab1c9f/2018/09/10/dynamodb-partition-key-1.gif

Primary Key: A primary key is the top field used for retrieving data from a Table. It can be either a single columns or multiple columns. A primary key is often referred to as an identifier or a unique identifier. A primary key should be unique for each record in the table. Primary keys are used to make sure that only one row of data can exist with any given value in the column or fields making up the primary key.

Composite Key: A composite key is a primary key that is made up of multiple columns. Composite keys are often used when there are more than one field that should be included in the primary key. For example, if you have a table with a field for each month and day of week, you can create a composite primary key by combining those two fields into one column so that only one row can exist for any given combination of Month and Day.

Partition Key: A partition key is a field that’s used to organize data into separate nodes or partitions within the table. This can be useful if you want to run different queries against different partitions of the same table. For example, if you have a table with a Partition Key column for each month; then you can query on that column and get back all of the records for one particular month at a time.

Clustering Key: The Clustering Key is responsible for data sorting within the partition. The values in the Clustering Key column will be used to determine where each record should be stored.

Visit systemdesign.us for System Design Interview Questions tagged by companies and their Solutions. Follow us on YouTube, LinkedIn, Twitter, Medium.

--

--