Serializable Snapshot Isolation | Systems Design Interview: 0 to 1 with Ex-Google SWE
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
Jordan gonna go far in his career. This guy is very talented and hardworking.
Completely agree i wait for his videos..
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
Well said
well summarized!
Your content has been so helpful. Learning these things from scratch
Glad to hear that Nathan!
Beastly content keep it up
Great video, your content helps a lot!
Damn it, these examples give me PTSD! Great content btw!
Great video! Haven't seen better explanation.
very well explained sir
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?🤔
While we can't always avoid deadlocks, grabbing our locks in the same order across transactions (where possible) should help us avoid them
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
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?
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.
I just managed to coom at the exact same time that I took a sh*t. Thoughts?
Surprised it took you this long to figure it out
Extremely based comment
How is life after google? Expecting more videos now
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
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.
Yup you're right good catch! I don't have a discord just yet, but looking into creating one!
Bro isn't even a google swe! just ask chat gpt and get the same explanations with more rizz.
True he's an ex google phony! Get him!
@@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?
@@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