What is Database Sharding, Logical and Physical Shards, Dynamic vs Algorithmic Sharding | 2021

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.ค. 2024
  • This is the twenty-first video in the series of System Design Primer Course. We talk about one more important component of System Design: Sharding.
    We want software engineers and aspiring software engineers to develop basics and get ready for the world of interviews as well as excelling as a Software Engineer.
    We talk about the following:
    Horizontal vs Vertical DB Partioning
    Logical vs Physical Shards
    Algorithmic vs Physical Sharding
    Pros and Cons of Sharding
    ------------------------------------------------------------------
    Recommendations
    ------------------------------------------------------------------
    Our full courses on youtube:
    ✒ System Design Primer Course: • System Design Primer C...
    ✒ REST APIs made easy: • REST APIs MADE EASY
    Some paid courses that we recommend:
    ✒Educative.io: bit.ly/3qnW5ku
    ✒Interviewready.io: get.interviewready.io/ (Use coupon code SUDOCODE for extra discount)
    ------------------------------------------------------------------
    About Us
    ------------------------------------------------------------------
    Created and Instructed by:
    Yogita Sharma
    ✒ LinkedIn - / yogita-sharma-83400b55
    ✒ Instagram - / sudo.code1
    ✒ Facebook - / sudo.code
    ✒ Medium - / yogita088
    Post-production(editing, thumbnail etc) managed by:
    CiKi
    ✒ Website: www.ciki.co.in
    ✒ LinkedIn: / 74735937
    Colors and design by:
    Naini Todi
    ✒ LinkedIn - / nainitodi
    Both Arpit and Yogita are software engineers and want to help other software engineers become better by providing high quality and well researched content by adding their creativity and teaching twist.
    ------------------------------------------------------------------
    Join Us
    ------------------------------------------------------------------
    Hangout with sudoCode:
    ✒Discord Server: / discord
    For business:
    ✒Email: sudocode.yogita@gmail.com
    ------------------------------------------------------------------------------------------------------------------------------------
    Timestamps:
    0:00 - Intro
    0:59 - What is Sharding ?
    2:15 - Horizontal vs Vertical shards
    5:46 - Logical Sharding vs Physical Sharding
    8:58 - Advantages of Sharding
    11:07 - Algorithmic and Dynamic Sharding
    13:33 - Disadvantages of Sharding
    16:06 - Some more important details about Sharding
    16:40 - Outro

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

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

    The greatest drawback is the "complexity" it brings in your architecture. Sharding is the last resort as you said. Nice video with clarity.

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

    a bright confident precise and concise lesson. you are a great teacher, kept my brain neurons constantly firing. what a class! keep all these good work.

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

    Short, crisp and explained in the simplest possible way. Thanks for the hard work you put in. It is indeed very helpful.

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

      Thanks Muskan

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

    This series is awesome. Watching most every vid

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

    Great video, nicely explained.
    A hands-on video to shard data on SQL and NoSQL databases will help a lot.
    Good work.

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

    The way Yogita teaches these concepts is too good. 😀
    Superb explanation

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

    Very Good Tutorial! Simplified the concept like anything. Sharding Key is a crucial here. Choose sharding if its really needed.. not every organization needed it. choosing wrong sharding key could bring lot of complexities and wrong data to the customer.

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

    Yogita, just wanted to let you know I read database sharding from other popular sources also but your explanation with example is best I found. Keep Going on !!!

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

    Very helpful, thank you!

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

    Highly interesting and useful content to a beginner. I think the basics are covered very well. Good job and thanks for the video

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

    One basic concept that can be added before getting into intermediate concepts like sharding - is Indexing. Often, before scaling up , it's better to index smartly to reduce the reading latency. Overall good video.

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

    Great explanation, the way you explained is that the concept is concise and informative, Thank you and keep going!

  • @siddharthgaur7919
    @siddharthgaur7919 3 ปีที่แล้ว +17

    Nice explanation yogita!! 👍 Hands-on demos would be really great!!

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

      Sure 😊 Will do share soon.

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

    Salute to your effort to explain the concepts, would love to see hands on for one relational and one non-relational db

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

    Nice explanation.! I like the way you try to convey without unwanted gossip and excluding intro

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

    Excellent explanation it helps a lot keep up good work…thank you so much it’s really helpful ❤

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

    Excellent & clear explanation. Kudos.

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

    Nice explanation! Great work

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

    Thanks a ton for this course. Really grateful

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

      You're very welcome!

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

    I respect the way you explain

  • @AKASH._._.
    @AKASH._._. ปีที่แล้ว

    Thank you so much, Mam.It was really Helpful😁

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

    awesome video...it really helped

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

    wow, well done!

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

    Great work once again!!
    Please keep it up!
    Waiting for sharding strategy and shard keys video!!

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

      Very soon!

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

    this will help me to understand the logic but hands on will give clear idea how its actually work

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

    Great ! A hands on video will make it complete. Thanks Yogita.

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

      Most welcome 😊 Will try!

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

    Great job :)

  • @rohit-ld6fc
    @rohit-ld6fc ปีที่แล้ว +1

    best sharding video

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

    Excellent content and explanation.

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

    great explanation

  • @yatishraja3998
    @yatishraja3998 2 หลายเดือนก่อน

    Your explanation is very good but your rate of speech is very fast and maintain a positive tone when you are explaining so that the viewer feels easy to digest the data Thanks

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

    Great content would like to see relational db sharding as a hands on first.

  • @subee128
    @subee128 22 วันที่ผ่านมา

    Thank you very much

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

    I'm happy this is free

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

    Great video

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

    Good overview. My comment is: Sharding and partitioning are not the same though they both are breaking up a large data set into smaller subsets. Sharding implies the data is spread across multiple databases while partitioning is about grouping subsets of data within a single database instance.

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

    Thanks Yogita for such a great video..really helpful..we would like to have lecture on how to shard relational DB and NOSQL DB.

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd 3 ปีที่แล้ว +1

    Nice Explanation of such a great and important topic in system desing. Please keep uploading more video, these are quite informational and it is very useful for cracking system design round for FANG! Thanks a lot for your time and effort.

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

      Thank you, I will

  • @mamtasingh-jo2fo
    @mamtasingh-jo2fo 3 ปีที่แล้ว

    Yogita,your videos are really very helpful to understand the sharding concept. I have followed the whole system design series.thanks a lot for making this series..

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

      Glad to hear that

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

    Being an architect myself, I can vouch this content is gold!

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

      Thanks for the validation Soham. Feels good to know that you liked our content.

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

    Yes please 🥺 we want hands on videos as well

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

    Yes, please a hands on video will be very useful.
    One on relational(any one) and non-relational(any one) DB.

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

      Noted! Coming soon!

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

      Having the theortical knowledge is good but seeing the practical application will give the understanding how it is really done in the industry.

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

      @@kumaraditya9986 You are right with your suggestion.

    • @PradeepKumar-db7pe
      @PradeepKumar-db7pe ปีที่แล้ว

      Dynamic sharding - does it also means db is sharded dynamically? Or is it dynamically decided which shards to query?

  • @GiriJeedigunta
    @GiriJeedigunta 8 หลายเดือนก่อน

    Great video thank you !!! What are the usecases for vertical partitions?

  • @2711Suvro
    @2711Suvro 2 ปีที่แล้ว

    18000 views 800 like... ☹️ you need to remind people to like the video in the middle of it... This was very helpful

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

    Hi Yogita, does adding more shards later on in the development phase also increase a challenge, what I mean is if we add another shard do I again have to redristribute the data from old shard ?

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

    What an awesome intro

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

    Good explanation

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

    Good job

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

    its Good explanation

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

    awesome

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

    Thank you Yogita for making this channel. I went through your primer course videos, and they explain all the concepts in a very detailed manner. However, I am not getting confidence how to give system design interview i.e how to connect all the concepts combined together to form a system. Could you upload a video in an interview manner like starting from a problem, discussion that happen between interviewer and interwee to proceed with the design?

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

    can we do replication as well as sharding for the same DB architecture, if so how. Could you please explain

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

    Videos are very good and clear.If you do pratical implementations of some topics then it would be crystal clear.

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

    I have a doubt, I see that in vertical partitoning example from 3:49 you have put each column in a different database server. Can we do that for vertical partitining? I read that only horizontal partitioning is spread across database servers whereas vertical partitining is done withing a server. Can we do it for vertical too?

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

    Great Explanation. Can you please make video on Time series DB ?

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

    Are their any other use case of logical partition other than query optimization?

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

    Great video as always.
    Hands on like sharding MYSQL would be great.
    Any plans for that?

  • @mayanktripathi4u
    @mayanktripathi4u 10 หลายเดือนก่อน

    Thanks for the video, this is really awesome. Though after watching and learning abt this I am more confused with the other various terms. Please make a video to clarify those. Database Partition Vs Table Partition Vs Distributed Database Vs Replication.
    What I understand is Replication is a Read-Copy with a distributed system. Distributed Database is having multiple database at different servers however in Sharding we are doing the same, if so what is the difference. And how the Database Partition is different than Table Partition, as in table partition we do not have to worry abt accessing it or no downtime is required however for database partition we would need some downtime when adding new partition.

  • @ashishkumar-lm6cv
    @ashishkumar-lm6cv 3 ปีที่แล้ว +3

    Hi Yogita, Your explanations are awesome but I think you can deep dive once basics are done and also if you plan to have real implementation it would be of great help as most of the developers don't have access to work at such a scale.
    Keep up the Great Work !!!!

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

      Noted. I will share.

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

      Hello Ashish, thank you for a point such a great point that will compliment her introduction. Great work Yogita.

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

    Great explanation. Which mic are you using? You voice is very clear

  • @77loutube
    @77loutube 2 ปีที่แล้ว

    So the strategy to scale in most use cases: Vertically scale -> Separate Read and Write -> Archive and keep it under control -> Try breaking the application into smaller services -> Shard the last resort

    • @77loutube
      @77loutube 2 ปีที่แล้ว

      add cache, replicas* in between

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

    Can't we create index instead of sharding like search query will be faster rather than doing sharding?

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

    Awesome content on Sharding, Can you please do a hands on practical video on how to do replication and sharding

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

      Will try to.

  • @ArunRaj-zq5kk
    @ArunRaj-zq5kk ปีที่แล้ว

    Is sharding and partitioning the data same? As per my understanding, partitioned the data based on column which will create separate file for each partition value, so that it will improve the read performance when we query the data based on partition column

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

    Hi Yogita, what is the use of logical sharding ? Thanks a lot for your videos ! :)

  • @Live-hh6li
    @Live-hh6li 3 ปีที่แล้ว

    Nice explanation
    Thanks

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

      You are welcome

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

    Before I say anything, I will admit I have no experience with sharding, but I do understand what you presented. Scenario. With 1million users, would you say that user info maybe be small but related user information, like images or videos can take up a lot of space. So it's not so much the amount of users as opposed to the space user supported data can take up.

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

    Should I design and code my own database engine?

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

    Very nyc yogita concept is clear

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

      Thanks :)

  • @2010aishwary
    @2010aishwary 3 ปีที่แล้ว

    very nice videos, please keep it going ..........

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

      Thank you, I will

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

    nice

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

    Please make practical sharding video

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

    i would like to see video comparing time series dbs for low latency large data sets.

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd 3 ปีที่แล้ว +2

    I had one question to ask : let's say that I have sharded the date in to mulitiple machines for desinging facebook, then in this case how the "FEED / TIMELINE" of a particular user be generated? One user can have multiple friends and he can follow many pages as well. So do we need to go to each of the shard where the friend of the user is residing to retureive the post information ?? It will make the system bit slow. How should we overcome this issue??

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

      Hi, when a particular user posts something then there is something called fanout services which push the same data into the timeline of the friends' user which is also maintained using some caching strategy and it happens in the background so that when friend user looks at their timeline can see the post and also one more thing to keep in mind is the data is eventually consistent in most of the social networking platform so it may take some time to update the timeline.

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

    Did you mention problem with transactions after sharading?

  • @sonalisatarupa5451
    @sonalisatarupa5451 10 หลายเดือนก่อน

    Helpful video .We would like to have hands-on on how to shard relational DB and NOSQL DB.
    Reply

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

    Can you make a tutorial on Spring Boot internal working?

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

    The best way anyone could have explained it. Been working in IT for the past 2 years I just feel lost in the CS concepts and never found any structured content. Since I did my bachelors in Electronics. Thank you.

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

    Yogita!!! your presentation is just amazing and out of the box.
    IMO you are the best teacher
    please please make videos on DSA too. I am 100% sure you will get overwhelming response

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

      Thanks a lot Akshay. 🤗

  • @PradeepKumar-db7pe
    @PradeepKumar-db7pe ปีที่แล้ว

    Dynamic sharding - does it also means db is sharded dynamically? Or is it dynamically decided which shards to query?

  • @ashishk8490
    @ashishk8490 2 หลายเดือนก่อน

    You teach a lot better than Gaurav Sen. Why don't you you launch your course on System Design. It would be a great help for all of us.

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

    Great explanation. One video if possible on Zookeeper please with use case.

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

      Will add to the list.

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

    Please make video on sharding in mongodb.

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

    demos for both relational and non-relation would be really helpful...

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

      noted!

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

    Thought: Would it be better to mindfully split the tables in different databases instead?

  • @justvenkyy...3423
    @justvenkyy...3423 3 ปีที่แล้ว

    reading data from a table having a index vs sharding , which gives more performance? index helps to look up isnt?

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

      Problems change with scale. Indexing might not help when datasets are huge.

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

    What is the point of having logical shards if we can have multiple physical shards?

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

    Thanks ! City based partion will come under column ( Vertical partion ) , right ?

    • @abhinavjaglan1782
      @abhinavjaglan1782 6 หลายเดือนก่อน

      no, it comes under horizontal data partitioning only, with city name as the shard key. all rows related to same city will be stored in same shard

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

    Hi Yogita, Thanks for such a vivid explanation. I just have one doubt. You gave an example of Tinder while talking about Sharding sometime around 10:22. We can shard on the basis of cities definitely. I was just wondering what would happen to a particular person's data (in db) when he moves from city X to city Y ? Will that data be lost ?

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

      Insert the record in new shard and soft delete from old shard

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

    DB Shards and DB Partitions are two different terms if we take distributed database into the picture. In fact, sharding and partitioning have different meanings in distributed system.

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

      Could you please link the source to your claim here?

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

      @@sudocode FYI -> th-cam.com/video/wXvljefXyEo/w-d-xo.html&ab_channel=AsliEngineeringbyArpitBhayani

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

    Can you please cover how bloom filter can help here?

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

      Will cover in a separate video!

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

    You should add link to the next and previous video in your description section

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

      good idea!

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

    Query across the shards is not a disadvantage I mean situation itself will not arise as in shards( horizontal partitioning ) we are going to put whole schema in any particular shard not just a specific table..

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

      Horizontal sharding implies splitting a table into multiple shards. In some cases all those shards have to be queried.

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

    Hands-on videos would be of great help

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

      will do try for sure.

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

    Please make videos on Data structures

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

      Will try.

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

    Good one. How sharing of db relate to cap theorem ?

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

      It's a long answer!

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

      @@sudocode may be I have used wrong world...it is sharding and not sharing..

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

    Hello, I really liked your video and your explanation is very clear but I don't agree with that partitioning and sharing is the same. For my knowledge partitioning is when we are splitting a table in database and sharing is when we are splitting data to different databases. So partitioning is done in the same database, we will just split/ partitioning the tables and sharing is done having multiple database, we will sharing data between database.

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

      I am sorry to say but that’s not accurate. Please check your source from where you read this. Check description for sharding links that I shared.

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

    Hi please come up with hands on using mongodb will help a lot 🙏

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

      Will add it to the list.

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

    Can you please make hands-on videos please. That will help in understanding things practically.

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

    horizontal and vertical sharding 4:20
    Sharding 5:26
    Logical and physical sharding 17:54
    advantages 9:00
    algorithmic and logical sharding 11:33
    drawback 13:53