AWS DynamoDB Schema Design | How to choose the right key

  Рет қаралды 207,478

Be A Better Dev

Be A Better Dev

Күн бұрын

AWS DynamoDB Tutorial. DynamoDB is a powerful fully managed NoSQL database. Part of the complexity in using the service is related to choosing a partition key that not only serves your access patterns, but prevents you from having scaling related headaches in the future. In this video, I talk about the factors you should consider when choosing a partition key. I start out by briefly talking about why choosing the right key is important, followed by defining partition and sort keys. Afterwards we go into key partitioning behavior and a feature called adaptive capacity. Finally, I conclude with some general guidance on when you should choose one key structure over another.
Looking to get hands on experience building on AWS with a REAL project? Check out my course - The AWS Learning Accelerator! courses.beabetterdev.com/cour...
00:25 Why picking the right key is important
01:10 Primary Key, Partition Key, Sort Key
09:24 When to use what key
🎉SUPPORT BE A BETTER DEV🎉
Become a Patron: / beabetterdev
📚 MY RECOMMENDED READING LIST FOR SOFTWARE DEVELOPERS📚
Clean Code - amzn.to/37T7xdP
Clean Architecture - amzn.to/3sCEGCe
Head First Design Patterns - amzn.to/37WXAMy
Domain Driver Design - amzn.to/3aWSW2W
Code Complete - amzn.to/3ksQDrB
The Pragmatic Programmer - amzn.to/3uH4kaQ
Algorithms - amzn.to/3syvyP5
Working Effectively with Legacy Code - amzn.to/3kvMza7
Refactoring - amzn.to/3r6FQ8U
🎙 MY RECORDING EQUIPMENT 🎙
Shure SM58 Microphone - amzn.to/3r5Hrf9
Behringer UM2 Audio Interface - amzn.to/2MuEllM
XLR Cable - amzn.to/3uGyZFx
Acoustic Sound Absorbing Foam Panels - amzn.to/3ktIrY6
Desk Microphone Mount - amzn.to/3qXMVIO
Logitech C920s Webcam - amzn.to/303zGu9
Fujilm XS10 Camera - amzn.to/3uGa30E
Fujifilm XF 35mm F2 Lens - amzn.to/3rentPe
Neewer 2 Piece Studio Lights - amzn.to/3uyoa8p
💻 MY DESKTOP EQUIPMENT 💻
Dell 34 inch Ultrawide Monitor - amzn.to/2NJwph6
Autonomous ErgoChair 2 - bit.ly/2YzomEm
Autonomous SmartDesk 2 Standing Desk - bit.ly/2YzomEm
MX Master 3 Productivity Mouse - amzn.to/3aYwKVZ
Das Keyboard Prime 13 MX Brown Mechanical- amzn.to/3uH6VBF
Veikk A15 Drawing Tablet - amzn.to/3uBRWsN
📚 References:
Getting started with AWS: • Introduction to AWS | ...
DynamoDB Global Secondary Indexes - • What is a DynamoDB GSI...
DynamoDB Local Secondary Indexes - • What is a DynamoDB LSI...
DynamoDB Accelerator (DAX) - • Improve DynamoDB Perfo...
SQL vs NoSQL explained - • SQL vs NoSQL Explained
Choosing the right key - aws.amazon.com/blogs/database...
Understanding Adaptive Capacity - docs.aws.amazon.com/amazondyn...
☁Topics covered include:
- Primary Key
- Partition Key
- Sort Key
- Range Key
- Partitions,
- Partition Splitting
- Read Capacity Units (RCU)
- Write Capacity Units (WCU)
- Throttling
- Adaptive Capacity
- Burst Capacity
🌎 Find me here:
Twitter - / beabetterdevv
Instagram - / beabetterdevv
Patreon - Donations help fund additional content - / beabetterdev
#DynamoDB
#PartitionKey
#SortKey

Пікірлер: 206
@dbejjam
@dbejjam 4 жыл бұрын
Am a veteran RDBMS guy and new to NoSQL. I got to say, the way your describe NoSQL stuff is just phenomenal.
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thank you so much for the kind words!
@venkatesh6384
@venkatesh6384 4 жыл бұрын
This is one of the most useful video I found on dynamodb keys. You made me your subscriber
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you for the kind words. Its comments like these that motivate me to keep making more videos. Thanks again and take care.
@srb1855
@srb1855 2 жыл бұрын
This was excellent - wish I had watched it 6 months ago! I was actually searching for "cardinality" and your vid came up among the first results.... Thanx again.👍
@suhasbadhe
@suhasbadhe 3 жыл бұрын
This is by far the best video I found for DynamoDB Keys!
@haris1558ssss
@haris1558ssss 4 жыл бұрын
You're such a gifted teacher. It's not easy to grasp all this information from the documentation. Thanks for the amazing video.
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you so much for your kind words. I actually kind of enjoy reading documentation and I'm glad I can translate that into easy to understand examples for all of my viewers. Thanks again!
@fahimuel
@fahimuel 4 жыл бұрын
Best Dynamo DB Schema Tutorials with precision knowledge providing all the use cases. Many Thanks.
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you so much for your kind words!
@leetsai6220
@leetsai6220 3 жыл бұрын
Great job explaining the topic and exploring the limitations. The way you explain a complicated subject with simplicity without sacrificing knowledge is sheer elegance. Keep it up.
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thanks so much Lee! Your comments means a lot to me :)
@tyronefrielinghaus3467
@tyronefrielinghaus3467 3 жыл бұрын
Yes BABDev: simplitivity without sacrificing knowledge...spot on! I like the way you explain everything. When I'm learning from a tutorial I HATE having to spend half the time googling what was mentionef but not explained....thanks for NOTsoing this...it really helps. Ps...great voice too...clear&well modulated. Just easy to listen to.
@sureshgandhi3918
@sureshgandhi3918 4 жыл бұрын
You are awesome and one of the best teachers I have ever seen. You boil down the concepts into simpler concepts extremely well. API Gateway tutorials please (I can even pay you for that :P)
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks Suresh for such kind words. It is comments like yours that motivate to keep making content. Thank you!
@osamaa.h.altameemi5592
@osamaa.h.altameemi5592 3 жыл бұрын
Man you really simplified it. The original documentation will take you in circles all over the place. Fantastic video.
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thank you so much! I'm glad you enjoyed the video and helped you understand the concepts. Daniel
@andrestone
@andrestone 4 жыл бұрын
The whole hot partition concern and the WCU / RCU hard limits are pretty much a thing of the past. DynamoDB will automatically reshard your partitions behind the scenes down to a single item if the disproportional velocity access is there. It means you'll only reach hard limit throttling if you have a single item being responsible for more than 1000 WCU / 3000 RCU.
@sumaiyaahmed4948
@sumaiyaahmed4948 4 жыл бұрын
Thanks for explaining in a simplified way. Very useful
@BeABetterDev
@BeABetterDev 4 жыл бұрын
You're very welcome sumaiya!
@Xhez2slash
@Xhez2slash 3 жыл бұрын
Splitting up the RCU to depict the partition capacity is by far the best way I seen hot partition be explained.
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Thank you!
@Xhez2slash
@Xhez2slash 2 жыл бұрын
@@BeABetterDev Thanks to you I got my Dev Associate!!!
@haciendadad
@haciendadad 4 жыл бұрын
Excellent video. Good speaker and provides content very well! Easy to learn from!!
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Much appreciated!
@akashseth7452
@akashseth7452 4 жыл бұрын
You just won a subscriber. High-quality stuff (y)
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks Akash! Glad you enjoyed.
@atomiorootshell2
@atomiorootshell2 8 ай бұрын
Fantastic video! Easy to learn. Thank you 🙏
@xiangyuncui373
@xiangyuncui373 4 жыл бұрын
Very clear, easy to understand, thank you!
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Glad it was helpful!
@aliciacollymore220
@aliciacollymore220 4 жыл бұрын
This was super useful, would be awesome if you could do a video on GSI and how that works, can't seem to wrap my head around it fully
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks Alicia. You''re feedback means a lot. I have one coming out this weekend on DynamoDB Autoscaling, but definitely plan on doing one on GSIs in the next month or so. Thanks again!
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hey alicia, check out this new video I just posted on GSIs! kzbin.info/www/bejne/n5mwgJ-YbaqNgac
@mangeshxjoshi
@mangeshxjoshi 4 жыл бұрын
Excellent video on DynamoDb partition key concepts , it would really help. If you could provide any video on DAX whenit can be used and its pros and cons
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you for the kind words. A video on DAX is coming soon!
@PulsePTYork
@PulsePTYork 4 жыл бұрын
How do you not have more subs? your channel is great! Keep it up mate!
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks a ton!
@MrMazharsamo
@MrMazharsamo 4 жыл бұрын
Simple and to the point explanation...Keep up the good work
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks a lot!
@ChauDuong1982
@ChauDuong1982 3 жыл бұрын
Best DynamoDb explained ever.
@XxGabberlordxX
@XxGabberlordxX 4 жыл бұрын
Hey! Your videos are very helpful and I learn a lot of things! For me and maybe another people it might be interesting to see an end to end project. You don't have to implement it but something like a general concept would be awesome. For example something like: Deploy a website and a REST service via AWS. Which services should we use and how to secure the backend and how to connect the REST API to a DB. Things like this would be absolutely awesome :) I'll definitely follow you and watch the other tutorials. Cheers mate :)
@codebreakthrough
@codebreakthrough 2 жыл бұрын
Great stuff! Very helpful, thanks.
@marcoavendano6593
@marcoavendano6593 4 жыл бұрын
I agree with all the comments here. Nice work describing this in simple terms.
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you!
@akshaykalambe9054
@akshaykalambe9054 4 жыл бұрын
Very nicely explained. Keep it up :)
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks Akshay!
@AIAnimationStudio
@AIAnimationStudio 3 ай бұрын
4 years alter... this run through is still very helpful. 👍
@sorover111
@sorover111 3 жыл бұрын
These are really good mane, keep it up 👍🏻
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thanks Michael!
@venkatk161
@venkatk161 4 жыл бұрын
Thank you. Well explained. Another subscriber here :-)
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you so much Venkat! Welcome to the channel.
@ramamoorthyvasanth
@ramamoorthyvasanth 4 жыл бұрын
This is super useful, please create a video on local secondary index as well
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks Rama! I'll add LSIs to my backlog of ideas. Cheers.
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hi Rama, in response to your feedback, I just created a video on Local Secondary Indexes - check it out here: kzbin.info/www/bejne/j2nKfqKQhLKMr8k
@vijaygokarn
@vijaygokarn 3 жыл бұрын
you deserve more subscribers .. keep up good work
@BeABetterDev
@BeABetterDev 3 жыл бұрын
I appreciate that!
@georgesoniarachel
@georgesoniarachel 3 жыл бұрын
Awesome tutorial !!
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thank you! Cheers!
@bhageerathbabuprathi1043
@bhageerathbabuprathi1043 4 жыл бұрын
Excellent video . It really helps. Thanks a lot.
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Glad it helped!
@syedzainrehan
@syedzainrehan 3 жыл бұрын
Very well explained. Thank you!
@BeABetterDev
@BeABetterDev 3 жыл бұрын
You're very welcome Zain!
@_cipriangg_
@_cipriangg_ 11 ай бұрын
Thank you for the info!
@emmanueladetutu8739
@emmanueladetutu8739 3 жыл бұрын
Awesome!! Thanks for this. It was very helpfull.
@BeABetterDev
@BeABetterDev 3 жыл бұрын
You're welcome!
@fitnecessity7386
@fitnecessity7386 4 жыл бұрын
Nicely explained! Subscribed :)
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Awesome, thank you!
@georgemap
@georgemap 2 жыл бұрын
Great Video, thank you for all the information! I have a question about filtering - which solution would you approach if you wanted to filter with multiple conditions? Equivalent to: WHERE country=„…“ & age=„…“ & … and so on (note: country and age are not pk or sk and without using filterExpressions) Or is there not a nice solution with dynamodb to that and aurora would be a better choice? Thank you in advance
@gustavoangelochannel
@gustavoangelochannel 3 жыл бұрын
Awesome video, keep the good work!
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thanks Gustavo! Really appreciate the kind words.
@HamzaAli-hv4md
@HamzaAli-hv4md 3 жыл бұрын
Great video. Thank you so much!
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thank Hamza, super glad it was helpful!
@anup00717
@anup00717 4 жыл бұрын
Very useful.. thanks for the video, AWS docs are jargon :P
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Glad it helped!
@jeffryjohn2508
@jeffryjohn2508 3 жыл бұрын
Thank you for this tutorial 🙏🙏🙏
@BeABetterDev
@BeABetterDev 3 жыл бұрын
You're so welcome Jeffry!
@vijayaprasadramachandran7603
@vijayaprasadramachandran7603 4 жыл бұрын
Awesome .. Simply put
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you!
@rakeshmishra8208
@rakeshmishra8208 4 жыл бұрын
Thanks, it's a great video :)
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Glad you liked it!
@blue_moon1_1
@blue_moon1_1 2 жыл бұрын
Impressed.... Very informative
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Glad you liked it!
@vimalneha
@vimalneha 3 жыл бұрын
Very well explained!
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thanks vimal!
@griscz
@griscz 4 жыл бұрын
Very helpful thank you!
@BeABetterDev
@BeABetterDev 4 жыл бұрын
You're very welcome!
@siddheshlatkar9839
@siddheshlatkar9839 3 жыл бұрын
Very nicely explained.
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thank you! 🙂
@kyriacoslouca2799
@kyriacoslouca2799 4 жыл бұрын
Very nicely explained indeed. I have seen some examples where the Partition Key is an UUID value. However, in some cases, I need my primary key to be an auto-increment integer like the one many SQL databases provide. What is your suggestion?
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hi Kyriacos, Unfortunately auto-increment isnt supported in DynamoDB. Generally speaking, in a NoSQL database it is advised to use a meaningful primary key so you can quickly retrieve your data by said key. Your access pattern should define what your primary key should be (even a composite key could be used). Your requirements make me think a traditional relational database could be better suited for your use case.
@ashguru
@ashguru 3 жыл бұрын
very well explained.. all stuff no fluff.
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Thanks ashutosh!
@EdwardLegaspi
@EdwardLegaspi 2 жыл бұрын
Hi. When designing a DB schema in DynamoDB how do you store the traditional lookup values like countries? In it's own table country with countryCode, countryName attributes? What's the best practice here? Thanks.
@ishaanme91
@ishaanme91 3 жыл бұрын
great explanation!
@XinWongDigital
@XinWongDigital 4 жыл бұрын
Thank u for sharing. Wud b cool if u mention filtering in the video
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Great suggestion!
@niteshgupta8436
@niteshgupta8436 2 жыл бұрын
Great video. Just one doubt. How to design my table if i have more than 2 fields for uniqueness (let's say 3 fields defining uniqueness. For example, in vehicle, make+model+year is unique)
@sagarsinghrajpoot6788
@sagarsinghrajpoot6788 4 жыл бұрын
Very Nice Explanation :)
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you Sagar!
@rishabhkohli7170
@rishabhkohli7170 4 жыл бұрын
Thanks amazing video
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you !
@andresm9051
@andresm9051 3 жыл бұрын
Great video, I got a question through an example If I had a sign up method in app and I can do it by email or phone number I was thinking about primary key because of cognito Id user, and that user sell products using many categories can have those products and categories under same table and row and query it by it's I'd, it's a good practice ? thanks
@calvinedwards6338
@calvinedwards6338 4 жыл бұрын
wow only 1.93K subs.. what a crime. Subbed!
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you so much Calvin for your kind words!
@kunalvids
@kunalvids 3 жыл бұрын
Thanks for wonderful video
@BeABetterDev
@BeABetterDev 3 жыл бұрын
You're very welcome kunal!
@rayprusia4753
@rayprusia4753 2 жыл бұрын
Great video Thanks
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Thanks Ray!
@tejasdevgekar1154
@tejasdevgekar1154 2 жыл бұрын
thanks dude
@criticalflow8733
@criticalflow8733 4 жыл бұрын
Nice one !! i just subscribed
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you!
@wajay2006
@wajay2006 3 жыл бұрын
Excellent video !! Do you have any video on data modelling a relational database in DynamoDB
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Hi Ajay, not yet but thanks for the great tip!
@lardosian
@lardosian 4 жыл бұрын
So in an amplify project for example, this schema is defined in the graphql schema yes? Do you have any such videos. I found a very good post on Dev.to from Nader Dabit about creating a robust graphql schema with directives, thanks!
@crimsonderrick
@crimsonderrick 4 жыл бұрын
Thank you
@BeABetterDev
@BeABetterDev 4 жыл бұрын
You are very welcome!
@SatejPrabhu
@SatejPrabhu 4 жыл бұрын
Good video.. after spending over a decade in SQL database.. its challenging to understand how SQL schema could be translated/redesigned to NOSQL. If you could make a video by taking example of AdventureWorks to show how you would design that use case in NOSQL, that would be great.
@pedrouriarterodriguez899
@pedrouriarterodriguez899 3 жыл бұрын
Excellent video and information, keep doing such quality content
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thanks you so much!
@lardosian
@lardosian 4 жыл бұрын
Thank you, just subbed. I'm about to get my hands dirty with AWS for the first time, use case is building an API and a PWA with React, was thinking of using the serverless framework, some advise to steer me in right direction would be greatly appreciated, I'm also doing my own research so it looks like I will need the combination of the following..API Gateway, Lamda functions, Dynamo DB, Cognito for backend, S3 for hosting, serverless for my framework, I'm sure theres more, thank you!
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hi Lardosian! Welcome to the channel. Great to hear you're getting familiar with AWS. In terms of your use cases, It sounds like you've identified the right AWS technologies for your use cases. Here are some additional videos I think could be helpful. IAM - IAM permissions are the bread and butter of AWS. You should get very familiar with them - kzbin.info/www/bejne/r2nGk36AdtRmeJY Lambda Introduction - kzbin.info/www/bejne/n4asiHpmnZd3bpY Building a REST API with API Gateway + Lambda - kzbin.info/www/bejne/q3fWkpx7nddksNU Basic DynamoDB Operations - kzbin.info/aero/PL9nWRykSBSFgmcJMpr7XAk3BC0VPAK_i- Hope this helps!
@lardosian
@lardosian 4 жыл бұрын
@@BeABetterDev Thank you very much, apologies for the late reply.
@surbhisingi5214
@surbhisingi5214 4 жыл бұрын
Is it possible for you to create a video on how to create DynamoDB table - having LSI and GSIs through Cloudformation script and add items in it using put_item from boto3 python SDK?
@jeffinj7707
@jeffinj7707 3 жыл бұрын
Great content
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thanks Jeffin!
@abhaygodbole9194
@abhaygodbole9194 4 жыл бұрын
Thanks for this very insightful session. Just would like to know where I can ask questions. I have one doubt about PutItem, which is not related to this video.
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks Abhay! feel free to ask here
@abhaygodbole9194
@abhaygodbole9194 4 жыл бұрын
I have asked it in your other video related to inserting items in DynamoDB.. Thanks
@Fernando1989mg
@Fernando1989mg 3 жыл бұрын
nice video, thanks u!!!
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Glad you liked it!
@geoa9722
@geoa9722 4 жыл бұрын
how to use update method with combination of partition key and sort key?
@yogithakakarla1716
@yogithakakarla1716 3 жыл бұрын
Most useful video
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Thanks Yogitha!
@kshitijvats5261
@kshitijvats5261 Ай бұрын
So does querying with parition and sort key will take logn time? Partition key will determine with hashing function the correct partition and then in that partition we will use sort key(log n time, where n is rows with same partition key value) to get to the reuqired row?
@hetalraval3928
@hetalraval3928 2 жыл бұрын
In my case i want to scan all data each time to compare with my response to know where update occur or insert and according to that i want to perform other requests...so what could be the best possible way?
@IanHuang-ch1cn
@IanHuang-ch1cn 4 жыл бұрын
Sorry, I would like to ask a question. At 6:18, you said that item with the partition key 3 will be stored in the same partition as item with partition key 1. But aren't they having different hash value after you put their partition key into the hash function? So why did they end up in the same partition?
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hi 黃翌軒, Depending on the size of your table, DynamoDB may store values with a different partition key on the same physical partition. As your data size or throughput demands grow, DynamoDB can re-split these partitions into smaller ones. Hope this helps.
@mdhruv1
@mdhruv1 4 жыл бұрын
Please can we get a tutorial. Where I can use curl to create an presigned url for s3 bucket object to load an file and download a file .
@sameerahmadbalaganur8958
@sameerahmadbalaganur8958 3 жыл бұрын
Really good
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Thanks!
@robertfrank2345
@robertfrank2345 5 ай бұрын
you rock!
@rhushikeshlokhande9108
@rhushikeshlokhande9108 4 жыл бұрын
Very Knowledgeable video Clare my table schema confusion. Please do share the Github link for code reference for serverless application if you have any..
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you Rhushikesh! I will post github links soon. :)
@Tellalca
@Tellalca 4 жыл бұрын
6:20 How does the item with Account Id = 3 goes into Partition 1? Shouldn't it go to Partition 3 since the Account Id attribute is defined as partition key?
@rockylovesall
@rockylovesall 4 жыл бұрын
IN my understanding, When the hash function is applied on the account Id it generated the target as partition 1. E.g. id % 2 ==0 will go in partition 2 and rest in 1. Hope it helps
@ashleyalex2713
@ashleyalex2713 Жыл бұрын
Suppose if we design sort key as countrycode#date, how we will be able to sort date only as we have country code along with it
@elenapaglia
@elenapaglia 4 жыл бұрын
New subscriber here too. I'm really surprised you don't have a lot more views and likes. Your videos are very helpful and easy to follow. I don't know if this is a topic for another video or related to this video... does this key approach require one entity type per table ? I've been reviewing AWS Docs and tutorials (specifically this one - aws.amazon.com/getting-started/projects/design-a-database-for-a-mobile-app-with-dynamodb/4/) where multiple entity types can sit in one table. I would like to implement this approach but it doesn't translate well when you look at the console. Do you have a video that can help me out ?
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hi Saturday! Thank you for the kind words of support, it means a lot to me! Regarding your question. It is possible to store multiple different types of entities within the same table. For example, in your example you have USER, PHOTO, REACTION, FRIENDSHIP entities. You can potentially store this data in one table by taking the following approach: Set your primary key to be IDENTITYTYPE_HashKey. One of your columns could be a serialized object in JSON representation of the entity type. The one caveat here is that the serialized data in your JSON column would be unsearchable from the dynamo perspective (range key search, global secondary index search, etc). However, if you are looking to store flat data of different types in one table - this approach will certainly work. Hope this helps and let me know if you have further questions!
@gauravshetty1436
@gauravshetty1436 4 жыл бұрын
what if partition key itself is unique an there are 1 million records example email id as partition key in user table?will there be a problem with too many partitions?
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hi Gaurav, Dynamo would split your data across multiple partitions in that case. There is no limit that I am aware of regarding number of partitions.
@shivamvats6146
@shivamvats6146 3 жыл бұрын
7:03 Why partion 3 row is in Partition 1 ? Shouldn't it be under a new partition 3 ? Please help, this is my only doubt left .
@oldoctopus393
@oldoctopus393 3 жыл бұрын
Double this question
@BeABetterDev
@BeABetterDev 3 жыл бұрын
The location the partition lands on is independent on the data. Rows that have differnt partition keys can land on the same partition.
@rohitkochar9022
@rohitkochar9022 2 жыл бұрын
also, with partiQL you can query table with a value without cretaing a GSI on that column. is that a new feature?
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Hi Rohit, the thing you need to be careful about using PartiQL is that performing queries are non-indexed columns can result in a scan operation instead of a query. This can cause high costs and poor performance for these types of operations. Hope this helps clarify.
@22222222222222223464
@22222222222222223464 4 жыл бұрын
Hey there! I have a question. What if I set RCU to 1? Does this mean that in this case all data will be stored on the one partition? Also, does this mean that the number of partitions for my table will be calculated from the RCU that I choose?
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hi Io, Setting your RCU to 1 will severely limit your table's performance and result in throttling errors. Do note that a single partition has a maximum size of 10 gb. Your RCU selection does has some impact on the number of partitions, yes!
@22222222222222223464
@22222222222222223464 4 жыл бұрын
AWS Simplified Thank you! Yeah I realise that it’s not good to set the RCU to 1. I would just like to know if it’s possible to calculate the number of partitions by RCU or not
@22222222222222223464
@22222222222222223464 4 жыл бұрын
AWS Simplified also, I’ve tried to get throttling during the writing new records. I’ve got it however all records have been stored successfully. How can this be?
@MiralkumarPatel
@MiralkumarPatel 3 жыл бұрын
Speaking of other strategies: How do you create composite primary key with 3+ columns?
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Hi Miral, I think it would be as simple as just appending each value using a delimiter such as value1-value2-value3. Keep in mind though this pattern requires you to know all these values before querying in order to find your records in Dynamo. Hope this helps, Daniel
@MiralkumarPatel
@MiralkumarPatel 3 жыл бұрын
@@BeABetterDev Thank for reply. That's the catch, the third column value is a timestamp and for that reason, can't perform BatchGetItem.
@rohitkochar9022
@rohitkochar9022 2 жыл бұрын
How did you define a date as sort key? I do not see type date. Do you define date as string?
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Hi Rohit date is just a string in this
@mohammedabdullah9537
@mohammedabdullah9537 3 жыл бұрын
Hey! how to find my table's details or description on AWS DynamoDB?
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Hi Mohammed, this should be in the Overview tab on the console after clicking the table name.
@alulaleak
@alulaleak 2 жыл бұрын
Is there a reason to use DAX over CloudFront??
@cjj1120
@cjj1120 2 жыл бұрын
Is GSI a new feature since it’s not mentioned in this informative video
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Yep that sounds correct
@jean-louisgouwy
@jean-louisgouwy 2 жыл бұрын
Most of the time, we depend of business rules. I mean, recently, we create a table with just an uuid (for each object). Then later, The business would like to retrieve thoses objects but without knowing the uuid, they need to retrieve the object by the name And lastModificationDate (between two dates). How do you manage that ? You have to create some gsi... But we do not have always all the information when we start the archtecture. This is very complicated when your project evolves with anothers features that you do not anticipate. This is my pain using dynamodb over mysql before.
@JamesSmith-cm7sg
@JamesSmith-cm7sg 2 жыл бұрын
The use case for Dynamodb is driven by high performance, so ultimately the business needs to understand the complexity of new queries. You can also utilise something like dynamo streams to update something like elastic search or ETL the data into a relational DB for complex queries.
@NiclasGleesborg
@NiclasGleesborg 2 жыл бұрын
How can a row with partition key "3" end up on Partition 1? 3:25
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Hi Niclas. Partition assignment is completely random. Hope this clarifies.
@deladonics
@deladonics 4 жыл бұрын
I must be missing something fundamental about Dynamo because I keep looking up how to retrieve all items in my table in a sorted order, but I keep ending up on articles and videos like this where they talk about read capacity and partitioning. I want SELECT * FROM table ORDER BY time ASC. I get the feeling I could give everything the same partition key and unique sort key and have them come back ordered but that has to be the wrong way to achieve my goal.
@NoSQLKnowHow
@NoSQLKnowHow 4 жыл бұрын
I am not sure of your exact use case and why you need to do a Select * FROM table, but I am pure guessing from the way you state your comment that more than likely you are trying to apply a relational DB mindset onto a NoSQL database, in this case DynamoDB. If you want to expand your comment, I am happy to try and help you though.
@deladonics
@deladonics 4 жыл бұрын
@@NoSQLKnowHow I have been messing around with Dynamo to build a serverless version of my blog. The traffic I get would be well under the free tier limit for both Lambda and Dynamo, so I could have a blog hosted for cheap. As an example of what I'm trying to do, I would call Dynamo to retrieve my blog posts and have them return in order of the sort key which is a timestamp. So far, I can only call scan and sort them after they return but eventually I'll want to do pagination and only return ten of the most recent posts.
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Hey Stephen! Based on your description, it sounds like you're trying to use Dynamo as if it were a traditional Relational Database. NoSql databases like Dynamo excel at quick retrieval for known values where you know the key (either singular or composite) that you are looking for. It can be extended to query for a key + a second attribute (sort key), but its functionality is pretty limited. Concerning your specific problem, you can solve this by having a table setup where your partition key is something like blog id (singular value) and your range/sort key is creation date. The combination of these values should be unique (as you can never create two blog posts at the same time). Using this approach, you can perform a paginated query in descending order on the sort key to get top X results (set your LIMIT to be X on your query). This isn't an ideal setup but should solve your problem. Hope this helps!
@user-nl9my9cd8j
@user-nl9my9cd8j Жыл бұрын
how to pagination using dynamoose
@64kuroina
@64kuroina 2 жыл бұрын
how many items can I set in the same partition key?
@BeABetterDev
@BeABetterDev 2 жыл бұрын
Hi ruru, There is no limit. However keep in mind that there is a 10gb max partition size in dynamo. I believe the partition splits afterwards. If you have too much throughput on the same partition key you make get throttling errors.
@64kuroina
@64kuroina 2 жыл бұрын
@@BeABetterDev thanks for answering me, the video was very helpful😁👍
@jivanmainali1742
@jivanmainali1742 3 жыл бұрын
How many partition Key could dynamodb could have??
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Hi Jivan, technically it is infinite.
@usamasaleem5624
@usamasaleem5624 Жыл бұрын
Can you please share the slides
@mrroboto4319
@mrroboto4319 4 жыл бұрын
"And for the lazy people, there is DAX" that killed me 😆. Nice guide!
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thanks Gustavo!
AWS DynamoDB Tutorial For Beginners
38:12
Be A Better Dev
Рет қаралды 341 М.
AWS Aurora VS DynamoDB
38:39
Be A Better Dev
Рет қаралды 78 М.
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 82 МЛН
DynamoDB Scan vs Query - The Things You Need To Know
11:05
Be A Better Dev
Рет қаралды 24 М.
How do NoSQL databases work? Simply Explained!
7:38
Simply Explained
Рет қаралды 1,1 МЛН
What is a DynamoDB GSI (Global Secondary Index) ?
10:19
Be A Better Dev
Рет қаралды 116 М.
7 Common DynamoDB Patterns for Modeling and Building an App with Alex De Brie
1:11:16
Top 5 Tips For Working With DynamoDB
8:28
Be A Better Dev
Рет қаралды 6 М.
MongoDB Schema Design Best Practices
50:39
Joe Karlsson
Рет қаралды 169 М.
AWS SQS vs SNS vs EventBridge - When to Use What?
22:37
Be A Better Dev
Рет қаралды 170 М.