What is DATABASE SHARDING?

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 เม.ย. 2024
  • Sharding a database is a common scalability strategy for designing server-side systems. The server-side system architecture uses concepts like sharding to make systems more scalable, reliable, and performant.
    Sharding is the horizontal partitioning of data according to a shard key. This shard key determines which database the entry to be persisted is sent to. Some common strategies for this are reverse proxies.
    Database interviews ask for concepts like sharding to make databases more performant and available. This makes horizontal partitioning a logical choice.
    Looking to ace your next interview? Try this System Design video course! 🔥
    interviewready.io
    00:00 Introduction
    00:52 Sharding - The problem
    01:59 Horizontal Partitioning
    03:20 Considerations
    04:30 Potential Drawbacks
    08:46 A challenge!
    Video lectures, architecture diagrams, capacity planning, API contracts, and evaluation tests. It's a complete package.
    Horizontal vs. Vertical partitioning: stackoverflow.com/questions/1...
    Consistent Hashing:
    en.wikipedia.org/wiki/Consist...
    • What is CONSISTENT HAS...
    Sources:
    / how-sharding-works
    / why-i-love-databases
    www.quora.com/What-is-the-dif...
    en.wikipedia.org/wiki/Partiti...)
    Designing Data-Intensive Applications - amzn.to/2yQIrxH
    #database #sharding #systemdesign

ความคิดเห็น • 696

  • @UlfAslak
    @UlfAslak 2 ปีที่แล้ว +317

    Notes to self:
    * Sharding is basically a hiearchical way to index databases.
    * One problem is that you have to split the database somehow. What do you split on?
    * You only shard shards when the shard grow too big.
    * When shard fails you use the master/slave architecture. Writes always go to master, reads are distributed across the slaves. When the master fails one of the slaves become master.

    • @rishabhrastogi6076
      @rishabhrastogi6076 2 ปีที่แล้ว +1

      Nicely put :)

    • @user-eq4oy6bk5p
      @user-eq4oy6bk5p 2 ปีที่แล้ว +6

      I think another important question to ask is what happens if your shard exceeds its capacity. The way it works is that it further splits the shard into smaller shards (DynamoDB does this behind the scenes)

    • @sarathbaiju6040
      @sarathbaiju6040 ปีที่แล้ว +2

      What will do when both master and slave failed?

    • @GvSharmaBKP
      @GvSharmaBKP ปีที่แล้ว

      @@sarathbaiju6040 replicate them atleast 3 (general practice)

    • @prateekgautam7398
      @prateekgautam7398 ปีที่แล้ว +2

      @@user-eq4oy6bk5p I just have one question. When we further break a shard into multiple shards, does those shards again go into different database servers? Or they reside in the same database server?

  • @stanlyjohnson5999
    @stanlyjohnson5999 5 ปีที่แล้ว +1035

    You know you're a programmer when you count pizza slices from zero :P

    • @gkcs
      @gkcs  5 ปีที่แล้ว +28

      Hahaha!

    • @sardorbekomonkulov6379
      @sardorbekomonkulov6379 4 ปีที่แล้ว +7

      Or really hungry

    • @mohammeddanishreza4902
      @mohammeddanishreza4902 4 ปีที่แล้ว +4

      U r wrong... Person might be a Matlab programmer where count doesn't strts with zero.

    • @anktrj
      @anktrj 3 ปีที่แล้ว +1

      ​@@gkcs Did you said "No we're not going to learn RDBMS" at t=40? BTW a great video Thanks!

    • @MattDeLuco
      @MattDeLuco 3 ปีที่แล้ว

      You know you’re a DBA when you count them from one ;)

  • @pavithranravichandiran6720
    @pavithranravichandiran6720 5 ปีที่แล้ว +442

    Can't just believe, you're uploading this for free... Please continue and we sure do want to sponsor the channel if that is in the cards!

    • @dhruvilpatel856
      @dhruvilpatel856 5 ปีที่แล้ว +5

      I see 67 likes so far. I doubt all 67 people are going to donate. XD

    • @ruhinapatel6530
      @ruhinapatel6530 4 ปีที่แล้ว +1

      Keep doing what you're doing..You explain too nicely...and your channel is the most handy updated and to the point..learning was never so easy..

    • @ishannigam7352
      @ishannigam7352 2 ปีที่แล้ว +1

      @@dhruvilpatel856 12k likes :)

  • @juggernaut420
    @juggernaut420 5 ปีที่แล้ว +152

    You could be a greater asset to this country if you pour yourself into research. I studied this course from the best of the best faculty in my college, who literally knows things, but you! Hands down man :)

    • @gkcs
      @gkcs  5 ปีที่แล้ว +17

      Thanks 😍

    • @avinashdwivedi2015
      @avinashdwivedi2015 5 ปีที่แล้ว +3

      You should have learned from best in world from internet..

    • @martintourneboeuf5282
      @martintourneboeuf5282 4 ปีที่แล้ว +6

      He could be a teacher in your University, but I wouldn't see him from Chile.
      Very nice videos in general. The intro of this one !!! Good job !

    • @Shomerful
      @Shomerful 2 ปีที่แล้ว

      lol research. you can be an asset in the industry as well.

    • @tusharrebaca
      @tusharrebaca 2 ปีที่แล้ว +1

      Now I seriously doubt about your College Quality :P :P :P - You should have more focused during your JEE time. :P

  • @1125ram
    @1125ram 4 ปีที่แล้ว

    I can't able to resist myself without commenting after I see your enthusiasm to teach to unknown people around the world... Hats off to all the vloggers who are sharing knowledge freely through TH-cam.

  • @sharathkumar1978
    @sharathkumar1978 4 ปีที่แล้ว +4

    The initial reaction of you saying sharding and your expression is awesome which makes someone really remember the video and the content by just imagining while asked in interview. Thanks gaurav :)

  • @official_roboGOD
    @official_roboGOD 5 ปีที่แล้ว +19

    Your System Design Playlist is my favorite. I've got so much to learn.
    Thank you!

    • @gkcs
      @gkcs  5 ปีที่แล้ว +2

      Glad to hear that 😁

  • @kshitizsharma5469
    @kshitizsharma5469 3 ปีที่แล้ว +8

    You are simply amazing man.
    I used to dread system design, but just because of you, slowly getting comfortable with it.
    I have actually allotted a particular share of my daily todo, just to watch your videos everyday.

  • @2devanshi
    @2devanshi 5 ปีที่แล้ว +21

    good precise and short. exactly what is required in tutorial video with a bit of fun element in start.. awesome job

  • @lien3723
    @lien3723 4 ปีที่แล้ว +5

    That little skit at the beginning is so funny lol. Thank you for making these system design videos, they're really helpful!

  • @Toy8610
    @Toy8610 ปีที่แล้ว

    You are a living legend Gaurav! I learned more from your videos than any of my previous teachers

  • @SupGhostly
    @SupGhostly 5 ปีที่แล้ว +20

    I love this play list and I'm learning so much but it the humor 😂 and your jokes that keep me learning great job man! Do you have a book recommendation on system design?

  • @satyagunnam6324
    @satyagunnam6324 5 ปีที่แล้ว +17

    I am a non-tech person, looking to learn system design concepts. You do a phenomenal job explaining these concepts & also super fun. Great job Gaurav & thank you very much!

    • @gkcs
      @gkcs  5 ปีที่แล้ว +1

      Thank you!

  • @theonlyarjun
    @theonlyarjun 3 ปีที่แล้ว +10

    For the first time in life I'm actually enjoying theory

  • @pradeeppradyumna601
    @pradeeppradyumna601 2 ปีที่แล้ว +2

    I like the way you present all the topics. It's so captivating, and it shows how passionate you're at solving System Design problems. Thank you for sharing your knowledge.

  • @ecandil
    @ecandil 3 ปีที่แล้ว +1

    I don't know how I didn't come across your videos before! What an easy way to learn, well done mate!!

  • @davidpham6330
    @davidpham6330 4 ปีที่แล้ว +2

    Never been so interested into database sharding just from that intro. You rock! Thank you for the videos

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      😁

  • @chandrabhattasriram9475
    @chandrabhattasriram9475 5 ปีที่แล้ว +22

    The way you slipped the "Like & Subscirbe" part into the video, just one word - S L I C K

  • @shivamtiwari8914
    @shivamtiwari8914 3 ปีที่แล้ว

    The topics covered were organized,relevant to me, and easy to follow . I loved it so much

  • @samart3010
    @samart3010 9 หลายเดือนก่อน +1

    Initially I was not able to catch this concept when I watched this video 2-3 years back. But as of now I am with a base knowledge I able to understand. The problem with me was not really a base knowledge, but a lack of perspective towards these system, I was sticked to my perspective and was trying to build over it, so sometimes it is better to gain knowledge with clear slate.

  • @alanclarke6096
    @alanclarke6096 4 ปีที่แล้ว +29

    What is Database Sharding?: Effectively partitioning the pizza

  • @sandeepjoshi8531
    @sandeepjoshi8531 5 ปีที่แล้ว +3

    You are too good brother. Your passion towards computer science can be clearly seen.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thanks Sandeep!

  • @sprihadeshpande2204
    @sprihadeshpande2204 4 ปีที่แล้ว +2

    You are one of the best. I can't wait to watch all your tutorials for system design! :) Keep going!

  • @darshathakkar
    @darshathakkar 4 ปีที่แล้ว +4

    Thank you for sharing this Gaurav. It means a lot.

  • @hidayatullahkhan6194
    @hidayatullahkhan6194 5 ปีที่แล้ว +9

    Woah opening was super cool

  • @AnuragSharma-pk9pr
    @AnuragSharma-pk9pr 3 ปีที่แล้ว +1

    I am an Oracle database developer. I loved your content man. Learned something new today. Thanks.
    Greetings from your new subscriber.👌👌😊

  • @XenonSchneizel
    @XenonSchneizel 4 ปีที่แล้ว

    Love your vids. The way you deliver your information is really clear and concise. Amazing quality content!

  • @ranjithpals
    @ranjithpals 5 ปีที่แล้ว +5

    That was a great job, can you do a video on what is a microservice and differences between soa and microservice?

  • @akankshagarg2204
    @akankshagarg2204 3 ปีที่แล้ว +1

    God I so miss eating Pizza in pre-lockdown days!! I have just started watching your videos for an upcoming interview and I am finding them quite useful. Thank you so much :)

  • @adnanqz4974
    @adnanqz4974 11 หลายเดือนก่อน

    You’ve explained this concept so well! At work, I’ve always heard my manager use this word when explaining his responsibilities with MongoDB but I’d never understand it. Now I do, thanks to you dude!
    PS: LOVED the ending 😂

  • @ALOKKUMAR-vt8bs
    @ALOKKUMAR-vt8bs 4 ปีที่แล้ว

    Sir,Your Work is too much Valuable and appreciated,
    Thank you so much for Doing this amazing work.

  • @0ManishSharma0
    @0ManishSharma0 5 ปีที่แล้ว +3

    This inspired me to watch all of your videos. Subscribed

  • @ypucandeleteit
    @ypucandeleteit 3 ปีที่แล้ว +1

    I recently found your channel and I just want to say I love your work. Thanks for creating fun informative content like this

    • @gkcs
      @gkcs  3 ปีที่แล้ว +1

      Thank you 😁

  • @rupal9267
    @rupal9267 2 ปีที่แล้ว

    You make life simple! The intro had me hooked in till the very end! Bravo!!! 👏

  • @thenavigtor6867
    @thenavigtor6867 3 ปีที่แล้ว

    Last line is ethusiastically official way of building interest in users...very well explained sir.

  • @DivyanshuKumar-xj7gw
    @DivyanshuKumar-xj7gw 5 ปีที่แล้ว +3

    Your way of explanation is really cool.
    Super video sir.

  • @saurabhsharma7123
    @saurabhsharma7123 5 ปีที่แล้ว +4

    That interview clip with doppelganger was awesome!

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Hahahaha! He's almost as good as me 😋

    • @saurabhsharma7123
      @saurabhsharma7123 5 ปีที่แล้ว

      He can easily send shivers down the spine of an interviewee, that's for sure 😅

  • @AyushRaj-so3zh
    @AyushRaj-so3zh 2 ปีที่แล้ว

    I had to stop the video immediately and come down here in the comments section 😊..what an intro...what a playlist..kudos Gaurav for these amazing videos

  • @pratikparikh8027
    @pratikparikh8027 3 ปีที่แล้ว

    The ending statement, That was the best

  • @Hotmustardgas20
    @Hotmustardgas20 4 ปีที่แล้ว

    I just discovered your channel and I'm a huge fan. I have been studying to get certified in AWS and your videos have been helping me understand larger concepts.

    • @gkcs
      @gkcs  4 ปีที่แล้ว +2

      Thanks!
      Interesting name you have there, Hotmustardgas :P

    • @Hotmustardgas20
      @Hotmustardgas20 4 ปีที่แล้ว

      @@gkcs Lol thanks I'm glad that you like it. Do you have any experience with the major cloud platforms that are out there? If so you should make a video on them.

  • @GruntXIII
    @GruntXIII 4 ปีที่แล้ว +23

    "Let's say you have pizza, and you can't have the entire thing by yourself..." you've obviously never seen me eat pizza...

  • @kiran-nambiar
    @kiran-nambiar ปีที่แล้ว

    I got sharing vs partitioning question in an interview. This image & whiteboard notes flashed in my head instantly, I did crack the interview but got better retention offer. Thanks man !
    PS - I should've used pizza as an example starting with 0 index, maybe next time...

  • @thrilokkumarpallaki9821
    @thrilokkumarpallaki9821 4 ปีที่แล้ว +2

    Awesome bro...while watching ur videos it feels like I came to movie

  • @sharthakghosh970
    @sharthakghosh970 5 ปีที่แล้ว +324

    "indexing is cute" hahahaha

    • @saravanprathi6956
      @saravanprathi6956 4 ปีที่แล้ว +5

      I had to pause the video and laugh for that :D

    • @Jonathan-qz9td
      @Jonathan-qz9td 3 ปีที่แล้ว +1

      Cracked me up 😂😂😂

    • @trishantpahwa6554
      @trishantpahwa6554 2 ปีที่แล้ว

      Cuter when all sharding can be personified as is indexing over the network, wouldn’t it? 😂

    • @nikhilkolhe7513
      @nikhilkolhe7513 2 ปีที่แล้ว

      Me spending days to implement indexes 😭

  • @tryitnow5944
    @tryitnow5944 5 ปีที่แล้ว +3

    You are crazy bro . Excellent video

  • @praveenX
    @praveenX 5 ปีที่แล้ว

    Great work guys! I just stumble upon on this video but it turns out to be great! loved your explanation and confidence. Keep it up. I have just subscribed this channel and would love to see more videos.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thanks!

  • @catman8623
    @catman8623 2 ปีที่แล้ว

    Love the explanation. Digestible while still retaining the core information of this utility and its implications.

  • @AdityaDodda
    @AdityaDodda 4 ปีที่แล้ว

    The first minute was Killer!

  • @Bace17
    @Bace17 3 ปีที่แล้ว +1

    "Let's say you have a pizza" This guy's a genius. Thumbs up for helping us relate with an actual example.

  • @interviewsortout2165
    @interviewsortout2165 2 ปีที่แล้ว

    First time I was watching some video tutorials and I did not sleep.

  • @rounakkolya7350
    @rounakkolya7350 2 ปีที่แล้ว

    OMG!!!Today's interview went exactly like this!!!!! except the sharding which led me to this video!!!!!

  • @manojmajumdar3815
    @manojmajumdar3815 4 ปีที่แล้ว

    I am thinking about the 255 others who have disliked this video, now who on earth would dislike such a well explained video!!!

  • @deeraj3069
    @deeraj3069 4 ปีที่แล้ว

    The ending was superb ...Enjoying the series very much

  • @seanpowers7132
    @seanpowers7132 3 ปีที่แล้ว

    This cat is smart. Thanks for dumbing it down for me. This is fantastic stuff Gaurav!

  • @rahulshetty3738
    @rahulshetty3738 5 ปีที่แล้ว +1

    This is really fun to watch!

  • @davidbanda4727
    @davidbanda4727 2 ปีที่แล้ว

    I work at Oracle and my first project was related to implementing XA Transactions in WLS + Sharding, 6 months ago, I was a recent graduate so it was very complicated 😂😭

  • @MohammadbinIsmail
    @MohammadbinIsmail 2 ปีที่แล้ว

    Went to Yogita"s videos ,came back here again , both are excellent masha allah

  • @sriharshasamana
    @sriharshasamana 3 ปีที่แล้ว

    You have made it look easy! Thanks bro. I want to hear more from you :)

  • @moulimallina7501
    @moulimallina7501 4 ปีที่แล้ว +2

    You are an amazing person with amazing talent. Once you happened to come our clg NIT raipur, that was wonderful lectures. Please make videos frequently

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      Thanks 😁

  • @deactivated6737
    @deactivated6737 3 ปีที่แล้ว

    Amazing explanation on database sharding, thank you for sharing.

  • @NikPnchl7
    @NikPnchl7 3 ปีที่แล้ว

    Cassandra uses consistent hashing out of the box to reach the shard that contains the data you're looking for. It uses the partition key part of the primary key

  • @ranzort
    @ranzort 4 ปีที่แล้ว

    Going through some of the videos. I can definitely see they are more entertaining as they go.

    • @ranzort
      @ranzort 4 ปีที่แล้ว

      Hitting like and subscribe button was pretty easy for me therefore sharding is ..?

  • @DeepakSingh-fi9tx
    @DeepakSingh-fi9tx 4 ปีที่แล้ว

    Hi Gaurav,
    Your videos are really very helpful. Apart from videos the references you have provided are mind blowing. Thank you so much.

  • @vaibhav1302
    @vaibhav1302 4 ปีที่แล้ว +1

    Simple explanation and to the point. Keep up the good work bro. Cheers

  • @boopiechot
    @boopiechot 5 ปีที่แล้ว +6

    That's exactly how my System Design interview went down. I got the job too. 😉

    • @gkcs
      @gkcs  5 ปีที่แล้ว +2

      Congratulations!

  • @rajiv8k
    @rajiv8k 4 ปีที่แล้ว +7

    8:45 🤣 I hit that notification button. The only other channel I have that turned on for is Kurzgesagt.

    • @gkcs
      @gkcs  4 ปีที่แล้ว +1

      Thank you!

  • @Anurag7376
    @Anurag7376 5 ปีที่แล้ว +1

    Your videos are really good. Editing and delivery are on point! Keep it up.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thanks!

  • @summasumma
    @summasumma 3 ปีที่แล้ว +1

    Nice video. Main problem i faced with Sharding is when you want to scale horizontally without impacting live system performance or creating downtime

    • @gkcs
      @gkcs  3 ปีที่แล้ว +1

      Absolutely. That's almost as hard as a live DB migration.

  • @abhijeetsoni1978
    @abhijeetsoni1978 2 ปีที่แล้ว

    Clear & crisp, to help understand the core concept of Sharding😊. And no, I wasn't able to click Like & Subscribe at a time, so had to do it sequentially. 😁

  • @KUNALSHARMA-rt9wv
    @KUNALSHARMA-rt9wv 5 ปีที่แล้ว +1

    Thankyou! I learnt something new today because of you.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Congratulations! 😁

  • @rohan1456
    @rohan1456 4 ปีที่แล้ว

    Your creativity and content just get's better.

  • @ChandanKumar-wb9vs
    @ChandanKumar-wb9vs 5 ปีที่แล้ว +1

    Starting part of the video was cute and hilarious 😂. Keep up that thing.

    • @gkcs
      @gkcs  5 ปีที่แล้ว +1

      Hahaha thanks!

  • @poorvaparande5933
    @poorvaparande5933 ปีที่แล้ว

    Thanks a lot! you are doing an amazing job and teaching complex concepts in a interesting way! :)

  • @thecraftschool7761
    @thecraftschool7761 ปีที่แล้ว +1

    Hey Gaurav
    Your videos are really helpful, easy to understand and so much fun to watch 😂
    Keep doing the good work 👍

  • @vibhors
    @vibhors 3 ปีที่แล้ว

    Bhaai toone toh rock kar diya, thank you , love you

  • @rahulsaikia9014
    @rahulsaikia9014 4 ปีที่แล้ว

    Dude you are doing really great; learned a lot from you!!!!! Liked, subscribed, shared!!!!!

  • @darod6098
    @darod6098 5 ปีที่แล้ว +1

    Excellent video! Some videos about the Map Reduce concept would be amazing!

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thank you!

  • @knightganesh
    @knightganesh 5 ปีที่แล้ว +1

    bro your soo amazing
    thankq soo much
    please conitinue to post awesome contents like these which could be understood by non CS person like me.

  • @timothy6966
    @timothy6966 ปีที่แล้ว +1

    This channel is a gold mind for entrepreneurs in the pizza-business.

  • @Sickbeatsdd
    @Sickbeatsdd 5 ปีที่แล้ว

    I just love all your videos
    can you post faster those competitive programming videoss

  • @asawari520
    @asawari520 2 ปีที่แล้ว

    that interview part was toooo good. especially when you say , we are looking for somethig more serious , we have huge hugeeeeee data. :-)

  • @stud3671
    @stud3671 5 ปีที่แล้ว +1

    Ty bro for this amazing video ❤️❤️

  • @noobninja4882
    @noobninja4882 3 ปีที่แล้ว +1

    First thing, i will never call my friend to help me finish the pizza, i can eat the pizza alone🤣🤣🤣
    thanks a lot for such an awesome content for free

  • @christophersanders7483
    @christophersanders7483 4 ปีที่แล้ว

    Thank you for this great video again. Better than many university professors.

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      Thank you!

  • @NikashKumar
    @NikashKumar 5 ปีที่แล้ว

    Gaurav,, great work. Appreciate all your hardwork. It helps a lot.

  • @monikakrishn
    @monikakrishn 2 ปีที่แล้ว

    oh god! the reaction when said "Sharding" by interviewee is humourous man :D

  • @ayushaggarwal7690
    @ayushaggarwal7690 3 ปีที่แล้ว

    Beautifully explained, keep up the good work, hope to meet you one day in person.

  • @rahulshetty3738
    @rahulshetty3738 5 ปีที่แล้ว +3

    Continue the great work!

  • @KrishnaDasPC
    @KrishnaDasPC 4 ปีที่แล้ว +1

    Good video here are my questions
    1. How do you make a practical application without Joins?
    2. Any code example of the concept?

  • @umarraza5533
    @umarraza5533 4 ปีที่แล้ว +1

    O bhai kahan sy le aye ho itni age ma itna knowledge. I really wanna know your learning strategies. Great man! Thumbs up, form Pakistan

  • @RahulDevanarayanan
    @RahulDevanarayanan 2 ปีที่แล้ว +2

    “The key thing is we couldn’t finish the pizza by ourselves, we needed friends”
    As an American I feel uniquely equipped to refute this assertion 😂😤😅

  • @Surajkocool
    @Surajkocool 4 ปีที่แล้ว

    Awesome explanation, expecting more form you. I am big fan your computer science, knowledge...

  • @abbhi1609
    @abbhi1609 2 ปีที่แล้ว

    Intro is awesome man!! Love it

  • @urunovtimes5816
    @urunovtimes5816 3 ปีที่แล้ว

    Oh my goodness, keep going again so nice.
    Really awesome.

  • @aakashjain3498
    @aakashjain3498 5 ปีที่แล้ว +3

    I find your videos educating and entertaining as well.... Well done

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thank you Aakash!

  • @ChocolateMilkCultLeader
    @ChocolateMilkCultLeader ปีที่แล้ว

    Clean and simple explanation. Great work

  • @sreesysadm
    @sreesysadm 5 ปีที่แล้ว

    U r amazing gaurav... thanks for the upload

  • @paridhijain7062
    @paridhijain7062 ปีที่แล้ว +1

    Well Explained concept. 👍Understood it easy with those visuals in the starting of this video. It made the concepts more practical to understand. 🙌🙌

  • @AnubhavShrivastava
    @AnubhavShrivastava 5 ปีที่แล้ว +1

    Wao..role playing an interview is an awesome concept

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      😎