text stringlengths 0 2.68k |
|---|
So that was one of the hardest, one of the most strainful thinking things that I have ever done in my life. There were times when I used to get headaches thinking about it, it was that hard. And finally, one day I had the a-ha moment. "It looks like I have an answer to all the questions to make this thing work as a sha... |
So being able to analyze queries and identify these subparts and be able to outsource it to a database, and then do the rest of it on your proxy that's actually sending the queries required a different kind of thinking. I think that is one reason that I could think of why sharding is hard. |
**Jerod Santo:** Can you describe your a-ha moment, like what your realization was? Or did you just try to describe it in other words and I missed it? Because it sounds like you're describing the problem and the system with the proxy in there. But what was it that cracked the nut that said "A-ha! We can do it this way"... |
**Sugu Sougoumarane:** Yeah, so how did I do it? The a-ha moment was -- actually, there was an early a-ha moment, an early a-ha question, which is... So before sharding, before this generic sharding was there, the way the application worked was it would actually send a query, and along with the query it'll tell you whe... |
\[24:24\] And the question I asked myself is "This keyspace ID is a crutch. Can we move without it?" And it was scary, because the application knows the keyspace ID. But how would this system know the keyspace IDs? Vitess does not know the keyspace ID... So if you just sent me a query, what do I do with it? I don't kno... |
So then the question is "Oh, then in that case, how about the other queries?" There were other complex ways by which the application was computing the keyspace ID... And that's when what if we internalized each and every one of those things, then the application does not need to ever compute the keyspace ID. We will do... |
The next question was "But then if we took this over, what if there's a query that came where a keyspace ID could not be computed? What would we do?" That's when I realized, "Okay, then I have to understand the query." What if it's a join? What if it's a correlated sub query? What if it is a non-correlated -- so that's... |
**Jerod Santo:** Gotcha. |
**Sugu Sougoumarane:** The full SQL language can be supported, eventually. We just need to do a -- so the first implementation only supported some constructs, and then we slowly started adding more and more. But we knew that theoretically, all SQL can be supported in this sharded system. |
**Jerod Santo:** \[27:41\] So to the Keyspace ID point - so I understand the relational algebra and the entire SQL dialect, supporting all the keywords over time. That makes sense to me. The keyspace ID - as a non-Vitess user, I'm not sure how it works. Does the infra person or the team that sets this up, do they have ... |
**Sugu Sougoumarane:** Correct, yeah. There's a cool story there... The first keyspace ID was actually a random assignment. |
**Jerod Santo:** Okay. |
**Sugu Sougoumarane:** So we would take a user and say -- I don't know if it \[unintelligible 00:28:29.25\] I actually don't remember how we initially computed. We used to randomly assign them to shards. Actually -- oh, now I remember. A user was assigned a shard, and we would put the shard number in a lookup table. It... |
**Jerod Santo:** Sure. |
**Sugu Sougoumarane:** And then came the time when we had to reshard it. And we realized "Oh my God, how are you going to reshard this, because now there is this table?" That's when we transitioned to keyspace ID, where we assigned a unique ID to a user, and then we actually assigned that keyspace ID -- we changed actu... |
The interesting story here is at that time there were a large amount of arguments about "What is the best sharding scheme? Is range-based sharding good, or is a hash-based sharding good?" We spent hours fighting on it. There was no -- or a lookup-based sharding, right? There's so many sharding schemes... And that's whe... |
**Jerod Santo:** Gotcha. So you pick the one you want to use. |
**Sugu Sougoumarane:** You pick the one you want to use. |
**Jerod Santo:** And you don't have any opinions on that, as Vitess. |
**Sugu Sougoumarane:** Exactly. Exactly. That goes back to actually a story from -- I don't know if you've heard of Illustra. |
**Jerod Santo:** No. |
**Sugu Sougoumarane:** \[31:54\] So this is 1990s... Michael Stonebraker had, I think, just launched Postgres. And from that, he -- he founded a company called Illustra, which is a commercialization of Postgres. And the claim to fame for Illustra is that indexes need not be defined by the database. You can define your ... |
**Jerod Santo:** Yeah. It makes sense, because -- I mean, oftentimes opinionated software is better. Like, "We do have a golden path, or we do have a way that you should go." You can swap it out if you want, but this is what the framework or the tool thinks you should do. But when it comes to this -- like I said, and l... |
**Sugu Sougoumarane:** Yeah. The thing that I'm now starting to realize -- I'm now learning Postgres a little bit more deeply... I find the same ideas still there in Postgres, where indexes are pluggable, you can plug in data types, you can define operators... So I'm kind of feeling like "Oh my God, there's a lot of si... |
**Jerod Santo:** You've gone full circle. |
**Sugu Sougoumarane:** Yeah, so it's pretty exciting to see this. |
**Break**: \[34:22\] |
**Jerod Santo:** So what's different then? It seems like the concepts, the breakthroughs you had with Vitess, the proxy with the parser and the smart way of handling these key spaces, and the bring your own sharding... All this stuff seems like it would apply, at least conceptually, across to Postgres. But I guess at t... |
**Sugu Sougoumarane:** So the part that I'm still trying to figure out is -- so in other words, every idea that exists in Vitess will just smoothly port over to Postgres. But as you said, there may be details where it may not port as well. So there's a few -- at this point, we have made a few policy decisions, let's pu... |
**Jerod Santo:** Sure. |
**Sugu Sougoumarane:** What else will we leave behind? We will leave behind anything that is legacy in Vitess. Anything that we built in Vitess but continue to support because there are users using it, but if we built it from scratch, we wouldn't do it that way... So that we want to leave behind. And also, anything tha... |
So there are actually -- and there's a fourth category, which is if there are things we can improve, we should. More specifically, I do want to improve the high availability story in Postgres, because that is currently a big challenge that users are facing. There is no good high availability solution, so that is someth... |
And the place where I'm still confused about how to solve the problem - but we will figure it out - is "How do we solve this sharding and query processing"? Because Vitess can do query routing, Vitess has the concept of pluggability... The part that I'm thinking about is the Postgres pluggability is more at the binary ... |
**Jerod Santo:** Nice. |
**Adam Stacoviak:** Does that compromise your desire to be Postgres-native, considering what you learn with Vitess, being written in Go, et cetera? How does that compromise your maybe "Postgres for life" - I might be putting words in your mouth, but like this native Postgres way? |
**Sugu Sougoumarane:** So if you look at the Vitess design, it was designed to be -- for the longest time, we didn't want to implement anything specific to MySQL. We thought this should be its own database system, and we actually restricted ourselves to just SQL 92. Because SQL 92 is generic, all databases must support... |
\[42:01\] But what we found out is that people were hesitant to migrate over. They said "Oh, I want my application to run as is when I move over", which is what forced us to add MySQL extensions. So in other words, we could port the SQL 92 part of Vitess directly over into Postgres and it'll work. The problem is it's a... |
So I'm beginning to think that porting that means that yes, we can port it, but then we have a lot to build, a lot to catch up to everything in Postgres. And looking at 10 years from now or 5 years from now, when let's say we managed to get full compatibility of Postgres, we will still face the issue of these plugins, ... |
**Adam Stacoviak:** Mm-hm. How important is it to reuse a lot of what you learned with Vitess in this new world? Because I've gotta imagine all this work you've put in, and countless hours of open sourceness etc. - like, there's a lot in there. How important is it to bring a lot of it over? |
**Sugu Sougoumarane:** The learning is totally valuable. I mean, without the learning, we wouldn't be able to build it. If you say "rebuild Vitess to what it is" - it is a lot of code, but it won't take the 15 years that it took us to build it. \[laughter\] |
**Adam Stacoviak:** Probably nine months, six months... |
**Sugu Sougoumarane:** Even if we had to rebuild from scratch, it may take us a year, maybe. |
**Adam Stacoviak:** Especially with AI, right? I mean, that might be a big help there. I mean, Go is really useful in code gen tooling, and stuff like that, so I've gotta imagine that that might even be a leg up for you to speed up the process, potentially. |
**Sugu Sougoumarane:** Yeah, we have been using Claude to analyze Postgres... Yeah, so you're probably right, we can probably do this much faster than even what I'm talking about, if we had to rebuild this whole thing. |
**Jerod Santo:** So there's this common movie trope, the retired badass... I'm not sure what this trope is called. |
**Sugu Sougoumarane:** \[laughs\] |
**Adam Stacoviak:** \[unintelligible 00:44:32.26\] retirement. |
**Jerod Santo:** Exactly. For one last -- |
**Adam Stacoviak:** John Wick comes to mind, Jerod. I'm sorry. |
**Jerod Santo:** There's John Wick, Bruce Willis often plays this role... |
**Adam Stacoviak:** It's true, yeah. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.