Learning: NoSQL and DynamoDBPosted: September 1, 2019
As part of my AWS-SA-Pro studies, I’m finding myself doing a lot of reading / watching on the subject of NoSQL databases and in doing so have come across a video from re:Invent 2018 presented by Rick Houlihan (Principle Technologist, NoSQL). This one slide pretty much sums up NoSQL for me:
Tables in NoSQL (specifically DynamoDB) have just a few things that you can base your query on; within the Primary Key there is a partition key and sort key. You can create relationships by using the partition key as a grouping mechanism and the sort key as the most common attribute from which you want to query those relationships.
You can create further sorting keys from other data using Global and Local Search Indexes (GSI, LSI) – but these effectively create copies of the table data organised with alternative fields forming the Primary Key, so you want to minimise the number of GSI and LSI you use.
The whole point of NoSQL is to create a scalable database which reduces the load on the CPU that’s inherent with complex relational databases.. taking something like a delivery service, with 6 different tables in SQL and reducing it down to one table and three GSI in NoSQL. The table format and attributes you use for your Primary and Sort keys all depend on the access
methods patterns – ie, what sort of queries you run on the data (what data are you looking for and what’s your input variables/fields for retrieving that data).