Serializable Snapshot Isolation | Systems Design Interview: 0 to 1 with Ex-Google SWE

Sdílet
Vložit
  • čas přidán 3. 03. 2023
  • I may have to do a SWE rizz tutorial since I didn't do it this time around, it would be like the Blind leading the Blind
  • Věda a technologie

Komentáře • 30

  • @scottlim5597
    @scottlim5597 Před rokem +11

    Jordan gonna go far in his career. This guy is very talented and hardworking.

    • @saber3112
      @saber3112 Před rokem +1

      Completely agree i wait for his videos..

  • @mostinho7
    @mostinho7 Před 9 měsíci +4

    Thanks!
    Summary is use optimistic locking when you don’t expect most writes to be accessing the same data, and if they do one of the transactions will get rolled back and retried
    Use pessimistic locking when you expect transactions to access the same data

  • @nathanchungh
    @nathanchungh Před 8 měsíci +3

    Your content has been so helpful. Learning these things from scratch

  • @iFetaCheeze
    @iFetaCheeze Před rokem +4

    Beastly content keep it up

  • @viniciussales3333
    @viniciussales3333 Před měsícem +1

    Great video, your content helps a lot!

  • @konarkverma9102
    @konarkverma9102 Před 5 měsíci +1

    Damn it, these examples give me PTSD! Great content btw!

  • @rahullingala7311
    @rahullingala7311 Před 5 měsíci +1

    Great video! Haven't seen better explanation.

  • @osahoo07
    @osahoo07 Před 3 měsíci +1

    very well explained sir

  • @zhonglin5985
    @zhonglin5985 Před 3 měsíci +2

    Conclusion: SSI might not be a good option if there are too many conflicting concurrent updates as it could cause too many reverts/retries. However, wouldn't 2PL also have the same problem? In the situation of too many concurrent updates, I assume there will be many deadlocks if we use 2PL, which would cause too many reverts/retries as well. Am I missing anything here?🤔

    • @jordanhasnolife5163
      @jordanhasnolife5163  Před 3 měsíci

      While we can't always avoid deadlocks, grabbing our locks in the same order across transactions (where possible) should help us avoid them

    • @bulioh
      @bulioh Před 2 měsíci +1

      I had that same question, but convinced myself you wouldn't necessarily get more deadlocks in these situations. Basically I ran through a scenario where you'd get an abort with SSI, but didn't actually end up in a deadlock with 2PL, which was good enough for me to move on because my brain was hurting haha. Would be nice to see someone actually prove this though

  • @user-ee7oi8qv7f
    @user-ee7oi8qv7f Před 28 dny +1

    So basically we allow all the transactions to proceed in parallel and then if there is a conflict one of them is rolled back, giving it a look of serialized execution. But we could still have the write skew problem with this right?

    • @jordanhasnolife5163
      @jordanhasnolife5163  Před 27 dny +1

      Depends how we track the dependencies on the write, but I would think that a well implemented version of SSI would look for queries that have overlapping dependencies and roll one back if another committed. The whole point is to act as if things are serializable.

  • @scoopsicus
    @scoopsicus Před rokem +4

    I just managed to coom at the exact same time that I took a sh*t. Thoughts?

  • @saber3112
    @saber3112 Před rokem +3

    How is life after google? Expecting more videos now

    • @jordanhasnolife5163
      @jordanhasnolife5163  Před rokem +3

      Haha alas I have another job, life's good but the videos will keep coming :), will be more regular once I finish moving in early April

  • @danielvega-myhre4201
    @danielvega-myhre4201 Před rokem +4

    Shouldn't the caption at 7:28 say "Use serializable snapshot isolation instead of two phase locking if most transactions *don't* overlap with each other"? Great content btw, if you have a Discord channel can you link it? I seem to remember you mentioning it before but can't find it.

    • @jordanhasnolife5163
      @jordanhasnolife5163  Před rokem

      Yup you're right good catch! I don't have a discord just yet, but looking into creating one!

  • @philiphartman-queen1216
    @philiphartman-queen1216 Před rokem +1

    Bro isn't even a google swe! just ask chat gpt and get the same explanations with more rizz.

    • @jordanhasnolife5163
      @jordanhasnolife5163  Před rokem +1

      True he's an ex google phony! Get him!

    • @philiphartman-queen1216
      @philiphartman-queen1216 Před rokem +1

      ​@@jordanhasnolife5163 I have 1 point of confusion. Case 1 the transactions essentially poll at the end any reads that had uncommitted writes, right? Case 2 any value a transaction reads, essentially adds itself to a subscriber list so that if a faster transaction writes and commits that write before that earlier transaction completes it gets notified of the updated value, right? I guess the confusion is Case 1 sounds like "oh if theres an uncommitted write we should double check that sussy baka" but then case 2 sounds like every single read is treated as sus, am i correct? So are these two cases separate possible solutions, with solution two being slower since its kept aware of any last minute changes until the end of a transaction?
      I guess I really just want to clarify that the two cases/approaches are separate, and that case 1 is less reliable and less work/faster, and case 2 is more work/slower but more reliable, right?

    • @jordanhasnolife5163
      @jordanhasnolife5163  Před rokem +1

      @@philiphartman-queen1216 Nope these two solutions are working in tandem! In case 2: we list all transactions that depend upon a piece of data, so if a transaction comes along and changes the data, we abort the incomplete transactions that were depending on it