August 20251:27:478k views

Rewriting SQLite from scratch (yes, really)

About

In this episode of Database School, I chat with Glauber Costa, CEO of Turso, about their audacious decision to rewrite SQLite from the ground up. We cover the technical motivations, open contribution philosophy, and how deterministic simulation testing is unlocking new levels of reliability.

Transcript

Everything we said

00:00

Aaron Francis

In this episode of Database School, you are going to hear me, Aaron Francis, talk to my friend Glauber Costa. He is the CEO of Turso, and they are embarking on an ambitious full rewrite of SQLite from scratch. So of course, we talk about the reasoning and the rationale behind it, and then we talk a lot about the deterministic simulation testing, uh, that they're doing.

00:23

We talk a lot about the contributors and the open contribution model, and everything that is going into this full rewrite of SQLite. It's very interesting. I highly encourage you check this one out. Also, if you have anyone you want to hear on the show, let me know. I love having people on the show. This is a delight for me, so please reach out. Let me know who I should have on next.

00:44

If you want audio, there's audio. If you want video, there's video. You can find everything at databaseschool.com. All right, that's enough from me. Let's get to the show. Hey, y'all. Welcome back to Database School. I am here again with Glauber Costa, the CEO of Turso. Glauber, do you wanna introduce yourself?

01:04

Glauber Costa

Aaron, thank you so much for having me. Uh, uh, it's a pleasure. Uh, I think it's my second time here chatting with you, uh, and it's always a pleasure to, to talk about, uh, the things that we are doing. I'm Glauber Costa, as you, as you mentioned. I am, uh... I've been in, in the industry for a long time. Uh, I remember when I was a young guy, full of hair. Uh, most of that changed now, uh, some, some of it very in, in, in, you know, in very radical ways.

01:30

Uh, but I've, I spent the first 10 years of my career, uh, working in the Linux kernel, uh, the vast majority of that time on behalf of Red Hat. Uh, that's where, uh, uh, I met my t- co-founder, today co-founder, Pekka. Uh, so all in all, I've done that around 10 years, and then I joined a company, uh, that had a product that didn't quite succeed, but then they pivoted into a database, uh, in the NoSQL market called Scylla.

01:57

Uh, the data... They're still around. They're still very successful in, in the niche that, that, that, that they, uh, cater to. Uh, and then after another decade doing that, I had a very brief stint at Datadog, uh, for, for a year, where I learned a lot about, about many things in, in, you know, in the big tech world. Uh, and then we founded this company, and we are now, uh, rewriting SQLite from scratch, which I guess is what we're gonna be talking about today, right?

02:21

Aaron Francis

Yeah, that's absolutely what we're gonna be talking about.

02:24

Glauber Costa

Yeah.

02:24

Aaron Francis

Because, uh, just on the face of it, that sounds, it sounds crazy, and I know-

02:28

Glauber Costa

Yes

02:28

Aaron Francis

... a lot of the reasons you're doing it, um, and they're not crazy. And so we're gonna have to-

02:32

Glauber Costa

Yes

02:32

Aaron Francis

... we're gonna have to square that circle. But before we do, not only are we, uh, you know, internet friends, colleagues, you know, sometimes coworkers, we are now neighbors. You-

02:43

Glauber Costa

We're neighbors, yeah

02:44

Aaron Francis

... are now a Texan. You moved to Dallas. So just tell us quickly. We're, we'll talk a lot about SQLite, but we're now, we live, like, 15 minutes apart.

02:53

Glauber Costa

We do.

02:53

Aaron Francis

And we're still doing this remotely for reasons that-

02:55

Glauber Costa

That's right. Yeah

02:55

Aaron Francis

... I'll explains lat- uh-

02:56

Glauber Costa

Yeah

02:56

Aaron Francis

... explain later. But tell us.

02:58

Glauber Costa

Can I call myself a Texan, Aaron? I just arrived, man.

03:00

Aaron Francis

Of course you can.

03:01

Glauber Costa

If they're just... I-

03:01

Aaron Francis

Yes.

03:03

Glauber Costa

I, you know, just, uh, I- I'm very excited to be here. I, uh, I, I still have to police myself, uh, and make sure that I'm saying y'all, uh, uh-

03:13

Aaron Francis

Mm-hmm

03:13

Glauber Costa

... all the time, which is, uh, it, it... I haven't, I haven't picked up yet, uh, so feel free to correct me when I fail to do so. Uh, Texas is very hot. It's, uh, it's, uh, you know. I'm coming, I'm coming from Canada.

03:26

Aaron Francis

Sorry.

03:27

Glauber Costa

Uh, and, and the, the past five years, I, I was in a very small town. Uh, I moved there with COVID from Toronto. Uh, I, I was in a very small town called London, where the winters are way more brutal than, than Toronto. And, and it would get, uh, routinely to minus 20, minus 25, uh, sometimes a little bit more than that or a little bit less than that, right?

03:48

Just, uh... And, and man, Texas is, is hot. I mean, I, I knew it, but it's, uh, uh, it, it's... Knowing and, and it's, if you, if you watch The Matrix-

03:57

Aaron Francis

Yeah

03:57

Glauber Costa

... like, uh, walking, uh, knowing the path and walking the path, two different things. But look, everybody was calling me crazy. Everybody was calling me crazy for rewriting SQLite, and I do not want it to, that to be the craziest thing in, going on in my life. I said, "There has to be something crazier going on in my life." So I moved to Texas-

04:15

Aaron Francis

Yeah

04:15

Glauber Costa

... with a eight, at the time, eight-month-pregnant wife.

04:19

Aaron Francis

Oh.

04:20

Glauber Costa

Uh, and, and as you know, like, uh, the, the baby's threatening to come, uh, for, uh, a while, uh, with three kids. Uh, and because of the, uh, very draconian Canadian exit tax system, uh, uh, that taxed me on my capital gains, so unrealized gains including my, uh, VC-backed company, I left most of my money behind to pay those taxes.

04:40

So this is, uh, you know, rewriting SQLite is not the craziest thing-

04:45

Aaron Francis

Yeah

04:45

Glauber Costa

... I'm doing. Uh, and, and so moving to Texas, moving to Texas itself, it's fine. I mean, it's all the, the, the situation around it.

04:52

Aaron Francis

Yeah.

04:53

Glauber Costa

Uh, the, the, the pregnant wife without an OBGYN that she had to go look for, uh, and the other three kids and, and looking out for school and, and, and all of that. Uh, gladly and, and, and, you know, we, we had help, so thank you. I mean, if, if we, we, we, we had you helping us in, in a lot of those pretty tough situations we got ourselves into. Uh, so it's, uh, it, it, it's all going good.

05:13

Aaron Francis

Good. Well, I'm glad you're here, and that was a smart-

05:15

Glauber Costa

Yeah

05:15

Aaron Francis

... that was a smart PR move to do something even crazier-

05:18

Glauber Costa

Even crazier.

05:19

Aaron Francis

... which is move to Texas in the summer with a pregnant wife-

05:21

Glauber Costa

In the summer. There you go.

05:22

Aaron Francis

... and three kids, and pay Canada-

05:24

Glauber Costa

Yeah

05:24

Aaron Francis

... for the privilege of leaving, so.

05:25

Glauber Costa

That's... Of leaving. There you go.

05:26

Aaron Francis

That does make rewriting SQLite look, uh, pretty benign. So talk to us, um, before we get into the full, the full rewrite, explain, um, just a, a, a brief history of, of Turso, because Turso is the name of the company. So we-

05:41

Glauber Costa

Yes

05:41

Aaron Francis

... we're gonna have, we're gonna throw out a lot of words here. We're gonna throw out SQLite, LibSQL, Turso, Turso Cloud. So tell us, um, up until, up until maybe just, like, a few weeks ago, what was, uh, the name Turso? And we'll talk about what the name Turso-

05:57

Glauber Costa

Yeah

05:57

Aaron Francis

... is going to become, but explain, explain the company briefly.

06:01

Glauber Costa

Yeah. So, uh, we started, uh, we started this company, uh, in, in... W- and we had a couple of months in which we were doing something else altogether, uh, using SQLite. We were, we, again, we were users of SQLite, we, uh, Pekka and I. Uh, we are... In fact, I was talking about it on Twitter the other day, uh, X, uh, that I still remember where I was the first time I used SQLite.

06:23

So magical, uh, it, it was. And, and, and the year, it was 2004. Uh, I remember where I was sitting. I remember which side of the room I, I was sitting. I remember-

06:32

Aaron Francis

Sweet

06:32

Glauber Costa

... which, which computer I was using. I, I don't remember what exactly I was working on, but I remember, like, having this file that I just, uh, typed SQLite 3 and, and, and, and, you know, it's a SQL, it's a full SQL database. I mean, that's, uh, that was like 21 years ago, right? Just the 2- 2004. It's, uh, older than, than I guess a lot of people in, in, in your audience today. And-

06:53

Aaron Francis

Mm-hmm

06:53

Glauber Costa

... and so I, uh, I always loved SQLite. I was always a fan of SQLite. I, I, I am a huge fan of simplicity, uh, uh, which SQLite i- is the embodiment of, right? So I... We were using SQLite in our product that we were building, uh, and, and we pivoted away from, from that idea because we had, uh, we were starting to notice that SQLite is great, but it could be even greater.

07:22

Uh, and, and again, for context, Pekka and I, uh, my Pekka being my, my co-founder, we spent each one of us around 10 years working in the Linux kernel, so we are very comfortable, uh, with, uh, with C. Uh, we are very comfortable with low-level code. We also wrote a, a database. I actually wrote another database when, when I was at Datadog. Uh, so we're very comfortable, uh, with, uh, with, with the space.

07:46

And we figured, "Hey, look, I mean, just the... We can... SQLite is amazing, but it, it could be pushed in, in, in certain directions that, that we believe the, the, the, the industry today is going, um, and it will be even better." So, uh, the... And we also realized the s- specifically the things that, that we wanted to do at the time were not technically very complicated.

08:09

But the problem is that you make those changes, fine, uh, and then what do you do? And, and again, we've been doing open source for, for all of our lives, and what do you do is that you send this code back to the project. This code now becomes part of the project, uh, and then you go from there. But you can't do this with SQLite, right?

08:23

Aaron Francis

No.

08:23

Glauber Costa

SQLite is a ver- a lot of people do not know this, but they are a closed community of, uh... They don't accept contribution. The, the code is open. Uh, it's technically not open source. It's public domain, but I'm gonna let the lawyer... For me, it's all the same. I mean, I'm gonna let the lawyers discuss the differences. I do not care. Uh, uh, but, but it's a closed community because nothing, no code can make it into the, the main project.

08:46

Uh, the best you can do is convince the, the, the, the maintainers of SQLite, uh, to do it for you. Uh, if... And, and again, of course, there are only three people, and they have competing interests from, from a, a large group of people. Um, and we figure, "Hey, look, I mean, this is... SQLite doesn't have a technical problem. SQLite has a, a, a social problem in, in that sense." Because, I mean, the way the community is structured, uh, does not lend itself, uh, does not lend itself to, uh, a, a database

09:16

that can grow in scope. Now, a lot of people view this as a good thing.

09:19

Aaron Francis

Mm-hmm.

09:20

Glauber Costa

Um, I, I disagree. And, and, and, and again, my disagreement comes from the fact that we work together. So, so there's this thinking that, that if you, if you, if you make things big, they will necessarily become sloppy. Uh, and, and if you make, if, if you make something open contribution, if you open the gates, uh, things will necessarily become, uh, uh, bad.

09:41

And I understand where people are coming from because that is usually what happens, right? So, so I'm not, I'm not disputing that th- this is a correlation does not, does not exist. But, you know, Pekka and I have this example of Linux in, in which things worked very successfully. Linux started as a toy project, uh, from Linus Torvalds. Uh, famously, he says it in his first message to, uh, uh, that, that he sent about Linux, "This is a toy.

10:03

This is never gonna grow beyond the scope of a toy. It only works on x86. It's not architected to work in anything else." And today, Linux runs the world. It runs in every single processor that still matters. It runs everywhere from supercomputers to, to, to small devices and, and, and it powers the world. So, so, and, and, uh, so we believe it's possible. I mean, it's not auto- I'll grant that.

10:24

I mean, it's not to be taken for granted, and it's not automatic that things are not gonna turn into a big ball of slop, but, but it's possible. Uh, so, so we figure, you know, why can't we have something that is open contribution? Uh, why, why can... And, and we're not saying, this is something that some people understand that, "Are you saying that they're wrong in doing this?" I mean, I, I don't believe too much in, in right and wrong in, in, in this context.

10:47

I mean, uh, they have the right to do what they do, but we f- we figure like a... The usual open-source saying is if you don't like it, fork it. And, and that's what we did. So-

10:57

Aaron Francis

Mm.

10:57

Glauber Costa

So at, at the time, uh, we wanted to rewrite SQLite. Uh, what we thought at the time is that, "Hey, man, SQLite is amazing." Uh, it, it, it's probably, you know, it's a, uh, a w- it could be more. I mean, uh, imagine SQLite with this open con- with this open contribution community. Imagine SQLite being what it is today but with 30 people consistently contributing to it.

11:19

How, how amazing would that be? And, and, and we wanted to rewrite it, uh, and but we decided not to. Uh, and, and to keep it simple, let's just say we decided not to for because of reasons. Uh, some of those reasons maybe were wrong, some of those reasons maybe were right, but we decided we will fork, uh, SQLite instead, right? So ins- instead of, uh, in- instead of, uh, rewriting it, we would, we would fork it.

11:40

Uh, and that's how the LibSQL project was born. Uh, and, and Turso then the company, the t- you know, wa- was born out of that. So Turso at the time, uh, now, now with this context, uh, answering your questions very directly, uh, Turso at the time was a way for you, uh, to use SQLite as a serverless database on the cloud.

12:01

Uh, and so you could... We, we built a server around it, which was part of the LibSQL project. Uh, you, you could send HTTP requests, uh, with, uh, with your SQL statements to it, uh, and, and we would respond. And, and this would fix, in our view, uh, one, uh, a-a-and one of the areas in which SQLite wasn't that great, which is serverless, right?

12:24

Uh, and why? Because SQLite is just a file, so if you wanna use it in serverless environments, you can't. So when, and, uh, when you, you start with your project, that's all fine, but if you happen to pick a serverless provider, then, then you have to abandon SQLite. So we figure we're gonna start here. Uh, and over time, our ambition was always to push the libsql project in, in, in more ways than one, in directions.

12:46

So, so the way we framed libsql, the project, was, uh, this is the open contribution fork of SQLite, where everybody's welcome to come and contribute. Uh, and, and i- one of the ways in which we are contributing to sy- to, to this fork is by adding, uh, the, the hooks at the right places to allow us to use this over the network when... So i- it was beautiful.

13:08

Uh, you could r- develop locally in a SQLite file. Uh, but then if you wanna push this to serverless, you would just change the URL. Uh, and, and now we have the same database on, on the other side that you're now accessing over the wire. Uh, so that was Turso for the longest time. Uh, we did make other contributions to the libsql project. Uh, so in, you know, in, in line with our original intent, in line with our original goal, uh, of making libsql just like this open contribution fork of SQLite that will just expand and do things that SQLite cannot.

13:38

We added native vector search, for example. So you can, you could do your RAG workflows, uh, and you wouldn't need an extension. It was integrated with the language. It was not something that you had to, to, to bolt in. Um, and, and we added, uh, a vector search. And, uh, so, so if, if, if you go back to, if you go back to, to, to that, uh, if, uh, you, you had a, a fork of SQLite that i- what 80% of what it did was, uh, uh, allow it to be competently used, uh, over the

14:08

network when needed, and still retain, of course, the, the, the local, uh, the, the, the ability to run it locally. Uh, and then you had vector search. Uh, and, and that was 99% of what the libsql project had. It had some other things. I mean, it ha- one attempt that we had in making schema changes a little bit better. Uh, but we, again, we... And, and, and that's gonna become the story.

14:30

A- a- and I'll stop there to, to, to let you go into, like, why that, but, uh, to, to give you the hook. Uh, vector search on, on libsql is am- amazing, uh, uh, but, but not perfect.

14:41

Aaron Francis

Mm.

14:41

Glauber Costa

Uh, and, and the sch- and the schema changes, the, the, the way in which we improved, uh, schema changes in libsql is good because schema changes is one of the things that people are always complaining about SQLite, but it's not perfect. Uh, and, and the way, the way we use SQLite over the wire is also good because it allows us, you know, and that's the business that we still have. Uh, but, but it's also not perfect because there is a, there's a, there's a couple of things holding you back in, in, in doing that.

15:07

And, and that's where, uh, the rewrite, uh, came from, right?

15:11

Aaron Francis

Okay. So from what I'm hearing, it sounds like, uh, in terms of, hmm, open source or, like, for a project, uh, you know, using a project, there's kind of a continuum. On, on one side, there is just use the project as it exists, which would be SQLite. Then there's let's contribute to that project.

15:33

Glauber Costa

Mm-hmm.

15:33

Aaron Francis

Which in this case is just not possible. So-

15:36

Glauber Costa

It's not possible

15:36

Aaron Francis

... they have been, they've been very adamant about, um, they've been very adamant about this is, and I agree it's open source, I don't know, you know, the, the technical difference. This is open source, but it's not open contribution, and neither of us are making a judgment call on that-

15:51

Glauber Costa

Yeah

15:51

Aaron Francis

... like, decision, but it does make it difficult for outsiders to, like, have any influence on the project. Which again, is probably what the maintainers want. They don't-

16:00

Glauber Costa

Exactly, yeah

16:01

Aaron Francis

... want outsiders to have influence. Um-

16:02

Glauber Costa

And they ha- and they have the right to do so. I mean, just that it's fine-

16:05

Aaron Francis

They do

16:05

Glauber Costa

... yeah.

16:05

Aaron Francis

Yeah. That, that's the beauty of, um-

16:07

Glauber Costa

Mm-hmm

16:07

Aaron Francis

... you know, I think DHH says open source is a gift. You can take it or leave it.

16:11

Glauber Costa

Mm-hmm.

16:11

Aaron Francis

You don't get to, you don't get to dictate. Um, and that has led, um, at least in my opinion, that has led SQLite to be rock solid.

16:20

Glauber Costa

Rock solid.

16:20

Aaron Francis

And that's one of the things, that's one of the things that the, the community, the industry at large, um, likes about SQLite. Of course, it's fundamentally different than, you know, most other databases in that it is embedded, it is a single file. But it's also incredibly stable.

16:38

Glauber Costa

Mm-hmm.

16:38

Aaron Francis

Um, and they've been working on it for 30 years, and they've, you know, tested every potential failure. So you're at this point where, um, the, the next step in the continuum is let's contribute to it. Not possible. So the next step would be let's fork it.

16:55

Glauber Costa

Let's fork it.

16:56

Aaron Francis

Let's fork it. Let's try to keep it up to date with upstream, but add a bunch of stuff, and should they ever, um, wanna pull stuff in, we are so happy to give it back to them. That was publicly stated-

17:07

Glauber Costa

Mm-hmm

17:07

Aaron Francis

... in your, you know, your libsql blog post.

17:08

Glauber Costa

Right.

17:09

Aaron Francis

"Hey, if y'all ever want this, we are ready to give these contributions back."

17:13

Glauber Costa

That's right.

17:13

Aaron Francis

But it's not, you know, not on the table right now. Then at the very far end, the very far end of the continuum is let's rewrite it from scratch-

17:21

Glauber Costa

Let's rewrite, yeah

17:21

Aaron Francis

... which is where we're about to go. But, um, just to, like, paint the, the picture of all the, all the terms. So you and Pekka and the team have libsql.

17:31

Glauber Costa

Mm-hmm.

17:31

Aaron Francis

It is a fork of SQLite. Turso, the company, um, as it exists up until just maybe, you know, a few minutes ago, is the name for the cloud, like the, the hosting-

17:43

Glauber Costa

Yeah

17:43

Aaron Francis

... thing.

17:44

Glauber Costa

Mm-hmm.

17:44

Aaron Francis

So that's all up until the present moment. Now, at the present moment, we're going a step further, and we're doing something crazy, which is fully rewriting SQLite-

17:55

Glauber Costa

Mm-hmm

17:55

Aaron Francis

... from scratch-

17:57

Glauber Costa

Yeah

17:57

Aaron Francis

... instead of just maintaining a fork. We're rewriting it from scratch. And so let's talk about, um, let's talk about the decision to do that, because the last thing you said was libsql is good at this part, but not great.

18:09

Glauber Costa

Yeah.

18:09

Aaron Francis

It's good at this part, but not great.

18:10

Glauber Costa

But not great, yeah.

18:11

Aaron Francis

And you said that three times. And so-

18:13

Glauber Costa

That's right

18:13

Aaron Francis

... what is the, what is the limiting factor or the limiting reagent that makes the fork, um, unable to reach greatness, where the rewrite is presumably going to-

18:24

Glauber Costa

Yeah

18:24

Aaron Francis

... um, uh, reach that level that you're hoping for?

18:27

Glauber Costa

That's right. And, and, and then just to, to, to, to ... fully clarified the terms. Uh, a- a- and, and, i- i- you know, talk- talking about the past is always like that 'cause, uh, uh, hindsight is, is, is 20/20. But we decided to, to keep the, the name separate, uh, which we thought it was, it was a mistake. Uh, we, we learned it was a mistake.

18:48

So LibSQL and Turso existed as two different things.

18:51

Aaron Francis

Mm-hmm.

18:52

Glauber Costa

Uh, and one of the things that sometimes you're gonna hear in, in, in the startup world is that it is very hard for a startup to build a brand, uh, let alone two. So we ended up with a very confusing situation. Uh, and, and again, it's not... We were not ignorant to any of those things, we just thought, you know, weighted against other things and said-

19:12

Aaron Francis

Sure

19:12

Glauber Costa

... yeah, you know, this is the... So because it... I would have no shame in admitting, by the way, that, like, I, I wasn't aware of that, or I didn't hear the advice, et cetera. But the reality is, is that we just weighted it against other things. And specifically the thing, ju- just to, to put it on the table, is that, again, our main goal is, like, how do we create... We didn't wanna have a fork of SQLite.

19:32

We wanted to have the open contribution-

19:35

Aaron Francis

Mm

19:35

Glauber Costa

... fork of SQLite. So our fear was that if we br- you know, if we have the same brand as, as the company brand, uh, some contributors may feel discouraged to, to contribute, and, and they say, "Am I contributing to this company?" You know.

19:49

Aaron Francis

Sure.

19:49

Glauber Costa

Uh, and, and the way open source was, I think, 20, 30 years ago, th- this would've been a, a factor. So we decided to keep, you know, things very separate, and this is LibSQL and, and this is, uh, this is Turso. Uh, and what we learned over time is that for whatever reason, uh, this just doesn't matter. Like, it, it, it, it wasn't a thing, so we, we ended up with the burden of building two brands, but without the be- the, you know, the, the fear that we had that people would feel, uh, a- awash and, and, and not coming ju- just wasn't there.

20:19

And, and I think it's just a matter of, like, how open source evolved, uh, in, in the past 20, 30 years. Um, and also a matter that, like in, in all the things that you can do to push contributors away, this is probably less than the least. Uh, right?

20:33

Aaron Francis

Mm-hmm.

20:33

Glauber Costa

So, so, you know, maybe it does help you, like, by 1% or 2%. Like, having a community that, that is actually helping people and, and, and merging their contributions, uh, a- and, and if you, "Oh, I wanna build a computi- competing business to yours, yes, can I do that?" And we say, "Sure." Like, that is probably better and, and, and more important th- than the name, right?

20:53

Th- that's-

20:53

Aaron Francis

Mm-hmm.

20:54

Glauber Costa

So when we decided to rewrite, uh, it was clear to us that, okay, you know, since we are in a, in a sense restarting this project, let's do it right, uh, and, and let's call it Turso. Now, uh, we didn't call it Turso initially because it started as a, as an experiment. It wasn't something that we were taking seriously, and, and, and we can go into that, too.

21:14

But the moment it became clear to us that, oh, this, there's so much potential here, uh, and this is going to work, we're very convinced that this is going to work, we decided we were going to rename it. Uh, and, and, and then we just, for practical reasons, so we're not gonna rename it now, we're gonna rename it in the future, so we, uh, we were very explicit about that. We put it in the README that this was going to be renamed.

21:36

Uh, and then we started making moves towards making this renaming smooth and, and, and, and, you know, not confusing. But we are now at the point in which this rename came. Uh, so now the rewrite of SQLite that we are doing is called Turso, right? So this company now is all about evolving SQLite. Uh, and we still have the cloud product.

21:58

The clo- cloud product is there. I think the cloud product will, uh, evolve in, in interesting ways that it wouldn't before if we were not rewriting. And this rewrite is now called Turso Cloud. Now, it's still a little bit confusing for a little bit longer because the Turso Cloud does not run Turso, right? Because Turso is not production ready yet. The Turso Cloud runs SQLite, right?

22:21

But, uh, it, it, this is gonna be with us for, for a, a little bit longer. But if you fast-forward now, uh, at, at least it's clear that, you know, Turso is an embedded database. There is a product called Turso Cloud in which, that is compatible with SQLite.

22:32

Aaron Francis

Mm-hmm.

22:33

Glauber Costa

Uh, you can use SQLite databases on the Turso Cloud. And then you fast-forward another year, uh, there's no more confusion because it, there, there's the Turso database, and then you can d- you can use those Turso databases, which are compatible with SQLite, uh, in the Turso Cloud. Uh, so it's just us moving, right, in, in the direction of, uh, of, uh, um, reducing that confusion. But every time I'm talking about the cloud product now, the serverless, uh, uh, database, uh, the serverless SQLite, uh, we're talking about the Turso Cloud.

23:01

Uh, and I'm, when I'm talking about Turso, that's the rewrite of SQLite. Yeah.

23:05

Aaron Francis

Okay. Yes. That's very helpful. Um, and it sounds, it sounds just like growing pains, you know?

23:10

Glauber Costa

Yeah.

23:10

Aaron Francis

That seems, yeah, that just seems very normal to me. I like the-

23:13

Glauber Costa

And, and there are many, there are many ways to solve it, and, and some of them-

23:16

Aaron Francis

Mm-hmm

23:16

Glauber Costa

... are more disruptive than others. And, uh, like that's the, the way we solved it was a way which we believe was, was the smoothest, and, and, and that's why we went with that one.

23:24

Aaron Francis

Yeah. I like the, I like the decision to rename or name the rewrite Turso, because there was always, you know, it was a nice, uh, separation of LibSQL and Turso, but that created confusion. I mean, that just-

23:38

Glauber Costa

Yeah

23:38

Aaron Francis

... obviously was like, "What? Wait, I'm using what now?"

23:41

Glauber Costa

Yeah.

23:41

Aaron Francis

So you're at this point where you've pushed, you've pushed LibSQL potentially as far as it can go.

23:48

Glauber Costa

Yeah.

23:48

Aaron Francis

And Pekka starts working on, uh, Limbo, the, which is this, is just like experiment.

23:54

Glauber Costa

Yeah.

23:54

Aaron Francis

It's Limbo, named Limbo presumably because it's in between.

23:56

Glauber Costa

Exactly.

23:57

Aaron Francis

We don't know if it's gonna work.

23:58

Glauber Costa

Yeah.

23:58

Aaron Francis

We'll try it out. We'll see what happens. Limbo is now, let's forget that name. Listeners, don't worry about the name Limbo. Limbo is now Turso.

24:06

Glauber Costa

Turso, yeah.

24:06

Aaron Francis

Turso the embedded database, which is a ground-up rewrite of SQLite, which they always-

24:13

Glauber Costa

Mm-hmm

24:13

Aaron Francis

... tell you not to do. So talk to us-

24:16

Glauber Costa

Yeah

24:16

Aaron Francis

... about, talk to us about, um, kind of the decision. So it started out as a little, like, experiment.

24:22

Glauber Costa

Yeah.

24:22

Aaron Francis

But then when did you reach that inflection point of, "Okay, we, like, we have to do this"?

24:28

Glauber Costa

Yeah. Yeah. So, so, so the, uh, as I said, we, we, we had this idea to begin with Let's rewrite SQLite. Uh, we, we decided, we decided not to do it. And, and, uh, I think one of the reasons we decided not to do it was that, uh, we, you know, we wanted to keep things working from the start, and we wanted to be very compatible with SQLite and...

24:49

B-b-but, but you know, j- going back, those are all things we knew. It's just thi- it's just that we weighted things differently. And then, uh, to your point, uh, uh, in, in your question, like what, what, what was the limiting factor for libsql? Uh, SQLite's test suit is proprietary.

25:08

Aaron Francis

Mm-hmm.

25:08

Glauber Costa

Which, which is something, again, which is something that a lot of people do not know. Uh, if you download the SQLite source code, uh, there are some tests in there, of course. I mean, there's, there's some very basic unit testing. But a lot of people talk about the fact that SQLite is this amazing, uh, uh, uh, you know, piece of technology in the industry, very different from everything else because there are five times more lines of code in the SQLite test suit than in SQLite itself.

25:33

So S-SQLite is a testing project that-

25:36

Aaron Francis

Mm-hmm

25:36

Glauber Costa

... if you think about this, this ratio. But that test, that, that famous test suit that is five times bigger than the, the source code itself is not open source. It's, it is proprietary. Um, and what that means is that it is very hard to make deep changes to SQLite, even as the fork.

25:57

So, and again, we knew that, but we figured there would be other things that will make the decision to fork still be worth it. Um, and, and I think part of that is that we thought that SQLite will be... A-and this was ignorance on our part. We, we thought that maybe, uh, things could be more modularized than in practice they really could. I mean, we, we-- I think we underestimated the amount of work we could do at, in the margins.

26:20

Uh, in, in our idea, like, yeah, we can make this tiny change to the core, and, and then with that tiny change, uh, we're gonna make this pluggable and then we repla-- which is one of the things we did with libsql, by the way, just to get concrete. And we were successful at that in, in, in libsql, which is why we th-thought we, we gonna be able to be-- to do this with, with all features. We wanted to do replication, uh, for in, in the cloud, you need things like that.

26:44

Uh, and we wanted to do WAL-based replication. Now, WAL, the WAL in SQLite is the, is the most recent changes, the Write Ahead Log. So what we've done is that we made, uh, very tiny changes to SQLite to allow the WAL to be virtualized. Uh, and then you, you, you essentially allow the, the WAL to be replaced by your own implementation.

27:05

So we never changed the SQLite WAL. We made changes that allowed the WAL to be replaced by a different implementation. And then we had that entire implementation separate, done in Rust, uh, and very well tested, right? So, so that's how we figure, like we, we're gonna be able to, to keep doing this. Uh, so the fork is still the, the best way to go because, yes, you know, SQ-SQLite is, uh, uh, we're not gonna be able to do very deep changes, but we, we can go very far without making those deep changes because we can use the, the

27:35

strategies. Uh, and again, maybe they wouldn't be how you would otherwise do if you have a blank canvas, but, but, but it's fine and it's gonna work. Um, uh, vector search was already not like that. So to, so to, to add, to add vector types to, to SQLite, uh, it was very, very, very, very hard and, and we had to make very deep changes.

27:57

Um, and even then, uh, even then, uh, it was over a certain point we were not willing to do. So if you use, for example, vector search in libsql and on the Turso Cloud, because th- we deploy those libsql databases to the Turso Cloud, uh, you will see that it, it's very integrated with the syntax. You can use vector columns together with other columns, and you just add a type, and then you can do search.

28:20

You can do queries that mix and match normal SQL with vector. It's beautiful. But whenever you use an index, uh, then you have to explicitly write a join with, with an external table and, and, and, and all of that because we felt comfortable, uh, uh, pushing the changes to the core, to the grammar because it's easier to, to test in isolation.

28:42

But we were not very comfortable pushing those changes to the index lookup and the query planner because that is much, much deeper, right? In-

28:50

Aaron Francis

It's pretty gnarly.

28:51

Glauber Costa

So, so, so you end up, you, you end up... And, and we could not replace it either because th-then you go into the bytecode and the, and the code generation and, and all of that. So you get... Uh, same thing happened, similar things happen to schema changes, right? And, and, uh, we, we got into a point in which our schema changes in, in libsql are, are better than SQLite, but they're not revolutionary better because to do them well, you would have to go patch th-things that are very core.

29:17

Uh, and, and, and SQLite in the cloud, uh, the main problem that most of our customers have is that if, if, if the use case fits what we are good for, fantastic. And we, we tell people what we're good for, right? But a lot of people try to write a lot to SQLite, or, or maybe they don't think about it in advance and then the workload just grows and, and whatnot, and you end up writing a lot.

29:39

And one of the things SQLite is not very good for is, is writing a lot. And in the cloud, because you have the network, uh, time added to that, uh, you hit the, you hit the ceiling of what you can write to much faster than, than you can write. Uh, and again, fixing the SQLite write, uh, throughput problem is a, a-- it's not something that you're gonna do just by replacing a couple of things here and there.

30:02

Uh, and then we had the, we had the partner, uh, uh, uh, there's a very big company that unfortunately I'm not allowed to... Uh, I'm working with them to try to allow them to, to, to tell them who, who they are. But like, they wanted to do, uh, column-level encryption in, in SQLite.

30:15

Aaron Francis

Mm-hmm.

30:15

Glauber Costa

And then Pekka and I just said, "Look, man, it, it, it can't, it can't work like that, and, and what do we do?" Uh, and, and, and there were, of course, many paths of like, "Don't, just don't do any of that and, and try to focus." And, and there's a huge market, especially now with, with vibe coding and AI agents. Uh, lots of those use cases are coming to the Turso Cloud because we can offer people like unlimited databases-

30:36

Aaron Francis

Mm-hmm

30:36

Glauber Costa

... so every prompt of yours can have its own database. There's a huge market, uh, uh, to, to, to be pursued with SQLite as is. But man, what if, man? You know, what if, uh, w- what if we were to rewrite it? Like, uh, and, and that's how th- this idea started coming in, in, in, in, in our minds. And, uh, Peca wanted to do it and, and I was like, "Yeah, m- maybe it's not, you know, maybe it's not the best business idea.

31:02

It's probably the be- " We were convinced by then that, that, uh, the, the, the, the judgment call that we made wasn't terrible. The forking of SQLite was something that was very well-received, but, you know, maybe rewriting would've been better. Uh, you know, challenges with that too, but like may- maybe it would've been better. Who knows? And, and we were living in this what if, uh, scenario, uh, until Peca decided to do it.

31:25

I mean, that's what I love about him. Uh, e- even though I told him it was probably not the smartest, uh, you know, idea, uh, not from the technical point of view. But, uh, he decided to do it. Uh, we didn't wanna associate the company with that because, again, it was a very experimental thing.

31:40

Aaron Francis

Mm-hmm.

31:40

Glauber Costa

So he just did it on his GitHub account, uh, wi- without, uh, we, we never talked about it. Turso never talked about it. I never talked about it on, on X. You know, Peca a couple of times just mentioned, "I'm, I'm, I'm doing this." It was on his own GitHub account, uh, and, and he just did it. And, and, and he did very little. He did very, very, very little.

32:01

What he did is that he, he wrote a spreadsheet, uh, with all the features of SQLite. That is a file that's now in the Turso repository. This actually, by the way, was one of the reasons this project succeeded. With, with sometimes you talk about the technical reasons, and we go about all, you know, all of the... But one of the reasons I think the project succeeded is that Peca came up with this matrix of features.

32:23

It's a very long matrix of every single thing that SQLite supports, down to the individual opcodes of the bytecode generated.

32:31

Aaron Francis

Oh, wow.

32:31

Glauber Costa

Like this opcode, that, that opcode, that opcode, this other opcode. Everything that SQLite does, every function, every opcode, every language feature, uh, it's in a file called compat.md. Uh, and then he just said, "Is this supported by the project that was then called Limbo?" No, no, no, no, no, no, no, no, no, no, no. And then he started doing one by one.

32:52

The first one was select. Without where clauses, without anything, all he could do is select one, right? Just, uh, and then you flip the compat matrix to, to yes. Um, and, and, and, and then he decided to just do it in, in the open in, in, in his own GitHub account, and he did it for around three months, uh, if, if I'm not mistaken, something like that.

33:13

Then again, on, on, on he had many other things to do. It was just like a, you know, sometimes if my kids are sleeping, I'm gonna go hack on this. And after three or four months, after th- so now, now it's very explicitly going to your question, when did you notice this was going to be a success? We had an early sign. We had an early sign, and what was this early sign? After three or four months of Peca just doing this on his GitHub account, without talking about it, without, you know, without mentioning this anywhere, without any backing, right,

33:43

without, without anything, this got you 1,000 GitHub stars, which is what a lot of open source projects never get you. Um, which is a very cheap metric, but now's the, now's the real metric. libsql at the time, and r- remember, we wanted to cr- we wanna create, that was our goal. We wanted to create the open contribution because we always thought, man, if, if, if it was hard for us to make changes to libsql in, in the core, imagine how hard it

34:13

was for external contributors. It was, it was very, very, very hard. So we had contributors to the libsql project, but they, most of them were contributing very simple things. They were contributing to the drivers, which were part of the project, like the language bindings. We... And, and not that they married to those things, but we never managed to create the community of people doing hardcore database stuff, which is what we believe if that happens, imagine what we can unlock.

34:37

So imagine this, three or four months, give or take, of Peca doing this on his, as a side project on his GitHub account, 30 people contributing to this project. 30. libsql at the time had, had around 100, 100 contributors. Uh, this toy thing that Peca was doing, uh, you know, on, on his GitHub account, 30.

35:05

Uh, what does it support? It supports select and, and, and a couple of functions. Uh, s- and w- wh- who are those contributors? So we have, we have a lot of, we have a lot of, uh, we have a lot of, um, people, as I said, co- that were coming to libsql, most of them doing simple things.

35:27

The people coming to, uh, the rewrite, they were doing complex things.

35:31

Aaron Francis

Mm.

35:31

Glauber Costa

So complex, so complex that we decided to hire two of them to work on, on, on our server because they proved, you know, it, it was very obvious through their contributions that they were very, very, very good people, right? Like top-notch, top-notch in, in the industry. Like people that, that can hold water to any- anybody who- that has ever seen them.

35:54

I mean, o- one of them was actually working in the SAP team at Red Hat, like, you know, ve- very, uh, relevant stuff. Uh, the other person was actually not, uh, he was just having a, a random backend job somewhere, but like a fantastic database internals guys. Uh, and, and, and this was a signal that, that we didn't have with, with libsql, right?

36:17

And then what we decided to do in December the 16th, 2024, was only this. We're gonna do no extra work on this. And by the way, after we hired those people, they actually would decrease their contribution to, to the project because they were super busy, right? Just, uh, do- doing the other stuff on, on our server.

36:37

And, um, we decided to graduate this project from Peca's personal pet project To a Turso pet project. We're still ca- we still-- we, we, it, it, we, it was still like, hey, we were very clear when we wrote the blog, there was a blog about it that, that you, you can link it if you want, uh, uh, in December, uh, around that time, said, "Don't read too much about it.

37:03

Don't read too much into it. This is just an experiment. Uh, if it works, maybe in the future we can get some people working on it." Um, and, and it was just like, this is something cool that we're doing. This is a, a, a... You know, we were very clear about that. This is, this is just something we're experimenting with. Um, and, and I think part of us just wanted to see what happened and, and, and, and we also had this idea, okay, we, we're getting so many good people that maybe other-- we, we're gonna use this as a way to get other great people.

37:32

Uh, and, and, and who knows? I mean, in six months, in a year, maybe we can put, you know, take this more seriously. But we never had this intention at the time of like, uh... Because it sounded crazy. Let's just go all in into this, right? Because we have a company to run. We, we have the roadmap on, on the Turso serverless cloud and, and however you call it at the time.

37:55

But then we, you know, we move it from Pekka's GitHub account to our corporate GitHub account. I tweet about it, Pekka tweets about it. Uh, and then in three weeks, this thing jumps from a thousand GitHub stars to eight thousand GitHub stars.

38:13

Aaron Francis

Wow.

38:14

Glauber Costa

And from thirty contributors to sixty-four contributors. And this is the signal I care about because, again, our bet is that SQLite could be better if it had a community of contributors which it lacks, and we managed to maintain the high barrier to entry that, that keeps SQLite being the, the rock solid piece of...

38:41

So, uh, we are saying, "If we can do this and this and this, uh, then, then we'll be able to, you know, we'll be able to, to, to do something meaningful." And going from thirty contributors to sixty-four contributors, and obviously a lot of those are people who came and, and contributed something and went away, but, but many others came and stayed, right?

39:03

So from this jump, in this jump from thirty-four to sixty-four, we have at least five people who are still there today, right? Today, six months later. Uh, it, it was just a signal we could not ignore. We said, "Look," and, and it, it was just like, in our minds, it became clear that the industry agrees with us that there is a need for SQLite to be more, uh, that our experience was validated, like, the, you know, all of those things that we want.

39:31

But, but the requirement to do this was, it, it has to be something that we can contribute to at the core level. It, it can't be something that we can only patch the, you know, o- on- only patch the boundaries. Uh, e- even for people coming from the outside to buy into it, it had to be something that gave them the, the, you know, the, the boldness, the courage and the tools to make deep changes and, and, and to make this without the fear of like, oh, you know, the best would be to go this way, but we can't go this way because

40:01

we make that, we're not gonna be able to test this, right? Uh, so, so it became clear that for us to realize our vision, uh, uh, we had to, we had to do this from, from the scratch. And, and, and once more, in three weeks we saw this from a thousand GitHub stars to eight thousand, from thirty contributors to sixty-four contributors, and then we all went in for holidays, and when we came back from holidays, we decided we're gonna restructure the whole company, uh, in, in a way that allows us...

40:30

And, and what that means is that we killed the roadmap for the cloud. We had a one year, uh, roadmap in the cloud. Uh, we said, uh, we're not gonna do any of that. And by the way, we were ver- because a lot of companies, I think, I'm very proud of that fact. I think a lot of companies would have done this in, in, in a treacherous almost way, in which you're trying to fool... You know, keep, keep things going and, like, uh, try to make the appearances of, uh-

40:53

Aaron Francis

Mm.

40:53

Glauber Costa

uh, that the things are going in a certain direction, uh, while, uh, on, on the side working on the real roadmap. Uh, we do not wanna do this. We, we pride ourselves very much on being very transparent with our community. So we released a blog post in which say, "Hey, this is what's going to happen. This is what it means for the Turso Cloud. Uh, this is what... You know, we're still gonna support it. Uh, we're still gonna be put effort into that." So we didn't kill-- We're not gonna kill the product.

41:17

We don't-- We're, we're gonna be fixing bugs, we're gonna be improving it. Uh, but this feature, this feature, this other feature, this other feature is gone. We're not gonna be working on it anymore, right? So for example, uh, edge replication is a feature that we killed. Uh, uh, multi-database schemas, which was the ability to ch- change the schema for many database at a time is a feature that we killed. Um, a- a- and, and a couple of others.

41:38

So if you're curious, go, go read the blog po- blog post. We said, "We are deprecating all of those features. Uh, we're not gonna maintain our offering, uh, on Fly.io anymore. We're gonna be moving all of it to AWS." Uh, and our original plan was to keep both clouds, but we said we don't have the bandwidth to, to, to do this. We're gonna have to, to focus and, and that's gonna be the focus. Uh, this is what it means to you.

42:00

Uh, if you are happy, like, we're not gonna be making, uh, general improvements, uh, a- anymore. Uh, you know, some of them, of course, we do. If, if things are broken, we'll, we'll fix it. But we don't have a roadmap anymore of, like, improving things in, in a meaningful way for a long time. Uh, if you're happy, if the Turso Cloud is, is, uh... And then obviously we started referring to it as Turso Cloud because we knew at the, at the time that we were gonna make the change.

42:23

If it's good for you, if it fix, if, if, if, if, you know, if, if it solves your problem, great. If you think, uh, "It, it, it would solve my problem if only you would do this other thing," I'm sorry, uh, that's not gonna get done for a long time. At some point it will. Uh, but our new engineering effort is gonna go massively into, uh, rewriting SQLite. Uh, and, and again, we believe we're gonna be better off in, in, at, at the other end of this because then we're gonna be able to fix the right throughput issue.

42:49

We're gonna be able to fix the schema changes issue. Uh, and we're gonna end up, uh, when those things converge with a much better, uh, offering on the other side, even for the people still using the Turso Cloud. But again, we were very explicit about it. We said, "This company's now going all in." Uh, we, we, we are a, a venture-backed company, so we're, we're putting our financial, uh, uh, uh, stability at risk.

43:12

Uh, we obviously we do not wanna do this. Uh, what we did was we, we let go a lot of people, uh, and we let go exactly, uh, of the people who will be working on the, the Turso Cloud. We want people working in, in marketing functions, right? People working in, in, in, in backend functions, people working in frontend functions. So we said all of those people are gone. That gave us plenty of time.

43:33

So we, you know, we, we had, we had at the time of more than two years of, of cash to execute this vision. 'Cause, you know, we wanna make sure that the company was still financially robust, which it is.

43:41

Aaron Francis

Mm-hmm.

43:42

Glauber Costa

Uh, the Turso Cloud today brings in more money than it costs, right? So, so, so it's a great place to be. Uh, and, and even after all those changes, we, we had of course a couple churn, but, but even, especially because our AWS software is so much more efficient to run, uh, the Turso Cloud brings in more money than it costs. Uh, so, so we, we can put all of our new engineering efforts into, uh, rewriting SQLite.

44:05

And, and that's what we're doing today.

44:07

Aaron Francis

Okay. So there's a lot, there's a lot there. I wanna dig in on that, that turning point of, um, you got to 1,000 stars and then jumped to 8,000 and jumped to 64 contributors. So, um, I'm of two minds about this. One is, that is like incredibly good signal for an open source project.

44:32

Glauber Costa

Mm-hmm.

44:32

Aaron Francis

And, you know, 99% of them never get there. And so this is, this is a signal of something.

44:39

Glauber Costa

Yes.

44:39

Aaron Francis

Right? Um, I guess my... That, that's the, that's the one mind. The other mind is that is not, that is not the business signal.

44:49

Glauber Costa

Mm-hmm.

44:49

Aaron Francis

Maybe it's a cor- a corollary to the business signal-

44:52

Glauber Costa

Yeah

44:52

Aaron Francis

... or like a, a parallel signal, something that tracks with it. Um, but that's not the business signal, right? So from a, from a business perspective, you're looking at, "Hey, we're gonna do this open source project. We're getting a ton of people in. That's really great." What does that signal tell you about the business side?

45:13

So you're receiving signal from an open source project. How are you translating that and applying that to a business side such that you look at it and you say, "I'm willing to, you know, I'm willing to not blow up, but fundamentally change the business because I'm getting-"

45:29

Glauber Costa

Yeah

45:29

Aaron Francis

... "this parallel signal from this open source project."

45:32

Glauber Costa

Yeah.

45:32

Aaron Francis

What did that tell you?

45:33

Glauber Costa

Yeah. So, so the, you know, w- what it tells us, and, and, uh, I had, uh, as I mentioned, I had that in my mind already. With libsql, we wanted to create this... And I mentioned that, um, many times. I'm just gonna do it again just in case somebody started listening now. But like, uh, we wanted to create this open contribution sq- uh, version of SQLite.

45:57

It was the open contribution fork of SQLite. Now, we did that for a reason, and, and, and, and, and the reason for that is that we believe that if we could do this, and if we could start to see people using libsql instead of SQLite-

46:12

Aaron Francis

Mm-hmm

46:13

Glauber Costa

... this is a tremendous business signal because, uh, you know, you, you now have people u- Most companies that have some open source presence, what they wanna see is a tremendous distribution in the open source, and then you wanna convert some of the distribution to a monetized offering in some way. You know you're never gonna co- convert everybody, but, but you wanna, you wanna have those numbers, right?

46:37

Um, and with SQLite, I'm actually willing to have lower conversion numbers just because the install base is so huge. Like, there are trillions of SQLite databases.

46:45

Aaron Francis

Yeah.

46:45

Glauber Costa

So I, I'm okay having a less than a percent of, of, of that converting to business in, in, in some way. Uh, but, but so we n- the business signal there is that if you can replace SQLite with your offering, you know, the, just the size of the community that, that, that you can have is the biggest community in the world.

47:06

And, and we'd wanted to do this with libsql. That was part of our goal, right? If, if you remember very explicitly we said... And, and, and again, we, we knew that to do this, it had to be not just better, but, but, but it, it should attract, it should give people who, who are using this a seat at the table. That's the thing that we wanted to do differently.

47:28

And with libsql, that did not happen, right? So, so with Turso at the time being called the, the Limbo Project, it happened immediately out of the bat. And then I started, uh... And, and, and so it, it wasn't so much that this gave us a new business signal-

47:47

Aaron Francis

Mm-hmm

47:47

Glauber Costa

... but it, it, that it reignited the business signal that we, you know, the business thesis that we had before, but we had given up on. So, so when, when, when you look at the story of libsql, it w- and I, and I wrote, I mean, all of that is public. I wrote it in the blog post. I mean, libsql was this thing that, that, that we shot. Uh, uh, were we unhappy with the results of libsql?

48:08

No. I mean, we are now in hindsight, but like, uh, at the time it was, it was that story about, you know, shoot for the stars, and you, you might hit the moon. We're like, "Oh, yeah, we, we got a moon landing with libsql. Pretty awesome." We were, we were able to do this cloud service and et cetera. But we were shooting for the stars. I mean, we didn't, we didn't hit it. Uh, we, we, we got to the moon and, and, and, you know, uh, pretty good place to be.

48:30

Uh, but with, with the rewrite, we saw, oh man, you know, the s- the dream of reaching the stars, it's still here. Uh, so, so this, it, it just reignited the thesis that we had, that if you manage to replace the, the, the most in an organic open source way, and to do that, we know that we have to be aggressively open source.

48:53

We will. We are. Uh, we are actually more open source than SQLite, right? And, and, and I can, uh, I, I'm happy to, to, to go into more details as to why I th- I claim that. But, uh- We, what we wanna give people now is a open source, open contribution version of SQLite that you can use instead of SQLite for anything you want, detached from our cloud business.

49:16

I mean, we don't want to bring people to necessarily to the cloud business anymore, right? We want, we want this to, you know, we want this ev- we want every device in the world to be running Turso. We want, we want every robot in the world to be running Turso instead of SQLite. We want every manufacturing facility in the world to be running Turso. We want databases everywhere. That's what we wanna do.

49:38

Uh, and we knew back then that if we managed to do this with libsql, this would be a home run. It just didn't happen. Uh, and, and we saw this happen, so it wasn't, it wasn't a new signal, it was just like a signal that we now could execute on the thesis that we had and, and had to adapt in, in, in, in the past, right? So, so that was essentially what was behind it.

50:00

Aaron Francis

So this, this is interesting because, um, from, I guess from, like, an outside or, or maybe naive perspective, it looks like, whoa, Turso the company has just taken a left turn.

50:13

Glauber Costa

Mm-hmm.

50:13

Aaron Francis

But this is a fulfillment of the original vision.

50:16

Glauber Costa

Yes. Of the original vision.

50:17

Aaron Francis

So-

50:17

Glauber Costa

Yes

50:17

Aaron Francis

... the original vision was, let's make SQLite open contribution.

50:23

Glauber Costa

Mm-hmm.

50:23

Aaron Francis

And the, the, uh, vehicle by which you did that was libsql. You found, uh, you found a lot of success, but not the success you were looking for.

50:33

Glauber Costa

Mm-hmm.

50:33

Aaron Francis

And so the original thesis was, let's, let's make a new, let's make a new SQLite, get a ton of distribution, and some, uh, small portion of that value will flow to Turso Cloud.

50:48

Glauber Costa

To Turso Cloud.

50:48

Aaron Francis

And-

50:48

Glauber Costa

Yes

50:49

Aaron Francis

... and that, you know, that worked on some level, but you plateaued in terms of what, uh, what you, and more importantly, what the outside contributors can do, right?

50:59

Glauber Costa

Yeah.

50:59

Aaron Francis

'Cause an outside contributor comes in and says like, "Holy crap, I can- I can't touch this. This is-"

51:04

Glauber Costa

Yeah

51:04

Aaron Francis

... "you know, SQLite internal dark magic. I am not touching that."

51:08

Glauber Costa

Mm-hmm.

51:08

Aaron Francis

And so y- you plateaued out on the original, the, the fulfillment of the original vision.

51:12

Glauber Costa

I j- I just wanna cla- just to clarify that it, it wasn't the business plateau. Like, T- Turso Cloud was still-

51:17

Aaron Francis

Correct. Yes

51:17

Glauber Costa

... growing, right? But, but, but the vision of replacing SQLite plateaued, yeah.

51:21

Aaron Francis

The vision of... Yeah. The vision of let's basically change the SQLite world, it ran up against a wall, which was SQLite itself.

51:29

Glauber Costa

Mm-hmm.

51:29

Aaron Francis

And so now, um, this is not, uh, this is not a fundamental vision change. This is just, let's try another, let's try another vehicle by which we can-

51:40

Glauber Costa

Yeah

51:40

Aaron Francis

... fulfill this original vision.

51:42

Glauber Costa

Yeah.

51:42

Aaron Francis

And so that is, that helps me understand why, um, something that seems, like, nominal or, like, eh, interesting but not that important, GitHub Stars-

51:54

Glauber Costa

Yeah

51:54

Aaron Francis

... that's why that now to me seems like, oh, okay. I get it. Like, the business thesis-

52:00

Glauber Costa

But, but that was, that was not, that was not even the strongest signal, because r- the strongest signal-

52:04

Aaron Francis

Sure

52:04

Glauber Costa

... we had was the number of contributors, because-

52:06

Aaron Francis

The number of contributors. Right

52:06

Glauber Costa

... that's the thing that, you know. Yeah.

52:08

Aaron Francis

The business thesis has always been if we can grow this contributor base, community, whatever, um, we can scale out this SQLite rewrite, and then we can hit a massive amount of distribution, and some portion falls to the bottom line of Turso Cloud.

52:25

Glauber Costa

Yeah.

52:25

Aaron Francis

So that, that whole, that whole story makes, makes a lot of sense to me now. Um, so I guess my question is, SQLite, famous, like super famous for being rock solid, right?

52:39

Glauber Costa

Mm-hmm.

52:39

Aaron Francis

You are taking on, you and Pekka and the team are taking on a rewrite of maybe one of the most stable pieces of technology to have ever existed, um, and you're doing it without the proprietary test suite. And so what are, what are you all thinking about in terms of how can we convince not only the outside world, how can we convince ourselves-

53:00

Glauber Costa

Ourselves, yeah

53:01

Aaron Francis

... that this is as stable as it deserves to be and as the reputation of SQLite is? How do... You know, that's gonna take years for you to get there-

53:08

Glauber Costa

Yeah

53:08

Aaron Francis

... in terms of reputation. But technically, how are you even gonna get close to stability, uh, when you don't have that test suite?

53:17

Glauber Costa

For me, this is the funniest part and, and, and, uh, you know, some- sometimes call, call it whatever you want. I know what we would call, like, destiny or the universe or, or et cetera. I'll, I'll, I'll leave it open to, to the audience, but, uh, providence. But this is for me the most, uh, amazing part of this whole story, because there is one thing that we have today that enables us to do this.

53:44

Aaron Francis

Okay.

53:44

Glauber Costa

And that thing is not something that we had when we started libsql. So if we, s- s- when, when we talk in terms of... It's funny, 'cause when, when I think about it and look at, look at, look, look back at it and were we wrong, were we right? Should we have rewritten this to begin with? Because that's what we wanted to do, right? But one of the reasons we didn't rewrite was exactly this.

54:07

I mean, with, with, uh, you know, even with the challenges that, that you have in, in touching the core, man, SQLite has 30... It's gonna take us years and years and years and years and years to, to, to, to, to get to that level of stability. Uh, and, and our mind at the time was like, how do we get to that level of stability? We have to write a ton of tests.

54:28

You have to essentially redo what SQLite has done and, and it's gonna, in our estimation, it's gonna take three years, it's gonna take four years, and then it's not worth it. It's, it's, let's, let's fork it instead. So that was the thing that was behind the fork, right? Uh, and ever since we, Pekka and I became acquainted with a testing technique that we used internally in our server.

54:53

Um, and, and again, we, it's not that does not, th- that this didn't exist at the time, it's just the, just wasn't on our radar. It was just not something that we were, uh, incredibly familiar with. But through looking at, uh, the industry and looking at, uh, other developments, and I will call out here TigerBeetle. TigerBeetle is probably, uh- I used to say that, uh, what I used to say is that even though I run a database company, uh, TigerVito is the database company that I appreciate the most 'cause they're the craziest guys out

55:23

there doing, like, some-something incredibly insane, which felt weird 'cause, I mean, I should feel like that about my own company. Mm-hmm. Uh, now, now I can say... N-now I'm in the point that I, I, I run a database company which is what I believe the, the, the, the, the craziest but the nicest database company. And in fact, the CEO of TigerVito became an investor. Uh- Oh, nice ... which w- w- I, I hope, I hope it means we just disagree on that, that, you know.

55:47

Ob-obviously his, his, for me, his company comes in a close second, uh- Mm-hmm ... and, and as the nicest database company out there. And I would hope that for him is just the, the reverse. Like, TigerVito is the best and then Turso come, comes as a close second. Uh, but they were using a testing technique called deterministic simulation testing. Uh, and if you, if you think about the way software is usually tested, it's just like this.

56:12

I mean, you have to write a, a F-ton of tests. You, you have to write five times more tests than, than, than you write, uh, code, uh, if you want this level of reliability. Deterministic simulation testing is slightly different. Uh, you don't write, uh, uh, you don't write unit tests, right? Uh, so, so if you think about how would, how would you test...

56:34

Le-let's th-think about an example. Uh, I am trying to test my select queries, uh, and I wanna make sure that every time I run from the da... I, I read from the database, I read the correct value. Uh, what you do is you try to come up, you, you, you, you write a, a databa- you the database file, uh, and then you'd run select star where something, and you match to see if the value is what you expected.

56:58

Uh, and then that's your unit test. And then you think, oh, but if, if you're writing at the same time that you're reading, you, you're gonna have a problem. Then you write another unit test in which you are writing it at the same time that you're reading and then, and then you read. Okay, but if you have an index, that-that's yet another corner case, and then you write another test to, to cover this, this, this corner case, right? What you do with deterministic simulation testing is that, uh, you don't write tests like that.

57:23

You write a fuzzer, which is a component that's gonna generate a large amount of random tests- Hm ... in a specific space. So, so of course, this is not magic. You have, you have to write this in, in, in... to explore a particular part of the space of, of possibilities. But, but once you define those boundaries, like, uh, you could have indexes like, you know, uh, between i-indexes in either none or all columns, uh, and, and, and then pairings,

57:54

random pairings of, of, of columns, uh, and then insert statements with this level of complexity and select statements with this level of complexity. So you write a, essentially a test generator. Uh, and, and then this test generator will generate a lot of tests, uh, and then your, your, your I/O subsystem in... And, and the project has to be written with that in mind. It's something that is very hard to bolt on.

58:16

Uh, so your internal I/O subsystem will inject random failures, right? So for example- Yeah ... uh, y-you, you, r-Turso has an I/O subsystem that does I/O, but during the simulation, you don't run the I/O subsystem, you replace it with the, with the simulated I/O. Uh, so, so you will be injecting failures, uh, all the time, uh, with a random probability. All of that is randomized, but it is de-de-deterministic.

58:42

So it is, it is using a, a pseudo-random generator. Mm-hmm. Uh, and if something fails, and if you pass a seed, you have the exact sequence of events that led to things. So debugging this is trivial. And again, having written, having written databases in the past, uh, once you have a failure that is a serious failure that leads to incorrect results, that leads to data corruption, like, you, it takes you months to figure out what's going wrong, right?

59:12

Because then you have to ima... H-how, how did that came to be? And you come up with a thesis, and then you try to reproduce it, and then you never reproduce it. With deterministic simulation testing, the simulator is exploring a large part of the space of probabilities. What, what Yoran always says is that we run centuries of s- of, of execution in, in 10 hours, right?

59:33

Uh, so, so you explore all of those crazy variants. And the way you test it is that you, you don't test anymore a single result, right? You test properties of the system. So it becomes, some people refer to that as property-based testing. For example, you do all of those inserts and et cetera, and then a-at the end, you run a integrity check of the database that makes sure that the B-tree is in a good state.

59:57

And, and if, if there was a data corruption, that integrity check will fail. Uh, or for example, you run a bunch of selects, uh, and, and, and, and then you sum them up and, and you... so it has to sum up to, to that number, right? Or, or- Mm ... like, y- you're always verifying not the results of an individual operation, but you're verifying that the sys- the properties about the system hold.

1:00:20

And then you let, you let, you let the fuzzer generate testing, uh, well. And if the properties fail, you have, you c- you can, you, you have the exact sequence of steps. So we were using this in the Turso Cloud, and we had those bugs that, that, you know, led to, lead to data corruption. Data corruption happens in, in, in databases, and it's one of the scariest things that, that can happen- Oh, yeah ...

1:00:43

because, like, your, your, you know, your data is actually worse than gone. It, it's corrupted. It's, it's incorrect, right? Mm-hmm. Uh, but, but you know, it, it happens and, and, and, you know, hopefully not often, but, uh, it's, it's the scariest thing in a database, in a database company. And we had those issues in which the data corruption happened. Uh, and, and six hours later, we had a fix, right?

1:01:07

Because those, those issues happen because the, the, the simulator did not explore some part of the space of possibilities well enough. And then what you do is, is instead of say- instead of thinking what was the exact sequence of events that led to this bug, your thinking becomes, what was the general conditions that could be present at this time that are not present in the simulator today?

1:01:35

Uh, and then you, you add them to the simulator, and lo and behold, uh, the, the bugs show up, right? So what you're doing is that if a bug is found, instead of spending months debugging this, you spend hours improving the simulator so that the simulator finds the issues for you. Most of the time you find those issues, uh, and, and, and then debug-- understanding why that happened becomes trivial because you have the exact sequence, the, the, the deterministic...

1:02:03

You ru- you just run the simulator again with the same seed and, and then you can have, uh, the, the exact sequence of events that led to that. So, so it's a, it's a, it's a, again, it's a testing methodology that is fantastic. It's, it's revolutionary. We're not the inventors of it, but, but we became acquainted with how... TigerBeetle, for those who don't know, is a database that is trying to rewrite the financial backbone of the financial industry.

1:02:25

They wanna be a database for, uh, and, and, uh, for-

1:02:28

Aaron Francis

That is crazy

1:02:28

Glauber Costa

... you know, for, for Visa-

1:02:29

Aaron Francis

That's why you admire them

1:02:30

Glauber Costa

... for Mastercard.

1:02:30

Aaron Francis

That's crazy.

1:02:30

Glauber Costa

So, so, so, so, uh, they had this issue. Say, how, how do we prove to banks-

1:02:36

Aaron Francis

Yeah

1:02:36

Glauber Costa

... that our stuff is gonna work better than they, their bespoke systems running for fifty years? And the way they did it was deterministic simulation testing, and they managed to do it, and they were like, "Hold on. Let, let's do it." And then we started doing this in the Turso Cloud. Uh, we, we rewrote large parts of, of our Turso Cloud server infrastructure to use deterministic simulation testing, and the results were, were awesome.

1:02:58

So when, when Pekka started thinking about maybe we should rewrite, you know, what if... When, when, when Pekka was having this vision of, like, what if, we now had the missing part of the puzzle. The way, the way we do this is with deterministic simulation testing from the start. So if you look at the first commits to this project, it was essentially not a database. It was a simulator, uh, of, of a database.

1:03:20

Uh, and then you start adding those things. Now, now write a query engine and, and expand the simulator to, to generate those queries. Now, the simulator doesn't catch any problems because if you're not writing to the database, there, there's very little that you can do wrong, but at least the simulator is there. Okay, so now we're gonna implement support for inserts. Um, uh, okay, n-now we have the simulator and, and now you improve the simulator to generate those inserts, and now it starts catching a couple of issues.

1:03:46

Uh, and then you go from there, from there, from there. So what happened between those, those-- between December and now that we just said, "Okay, now is the time that we rename this to Turso." Because if you go back to what I said, is that we wanted to do this from the start 'cause that was the lesson that we had from LibSQL. Ke-keeping both names doesn't do what-- doesn't do as much what we want to do in terms of benefits, but it has a huge cost.

1:04:11

So how do... You know, we were afraid that, you know, you, you download Turso, uh, okay, so now it's a single brand. You download Turso, but nothing works and, and, and, and it's full of bugs and so is it, is it really helping you? No.

1:04:26

Aaron Francis

Yeah. It's not gonna... No.

1:04:27

Glauber Costa

So, so what happened now that we were comfortable just saying, "Okay, now let, let's release Turso Alpha," is that our simulator doesn't catch any more bugs.

1:04:37

Aaron Francis

Hmm.

1:04:38

Glauber Costa

So we, we, we got to the point... Uh, and by the way, we, we do two layers of deterministic simulation testing. We use our own simulator, uh, and, and, and we also use a tool called Antithesis, which is a, a deterministic hypervisor that does that for you. So, so it's another... It, it, it's, it's a, it's something for way more complex, but I'm a super fan of what they're doing.

1:05:03

They are our partners on this. Uh, so we do two layers of testing, and both Antithesis, our external simulator... Uh, a- and Antithesis can, can, can do things that our simulator can't, right, by, by the nature of their design. Uh, and, and our simulator themselves, I mean, both of those components were not catching any bugs. Uh, and then what we decided is, okay, now this is stable enough that we can...

1:05:25

Now, it doesn't s- there are many things it does not support.

1:05:28

Aaron Francis

Sure. Yeah.

1:05:28

Glauber Costa

Uh, it, it, it doesn't, it doesn't do indexes, for example, which is one of the things that we're s- that we're doing, that we're doing now. Uh, there-- If you go to the compat.md file, there's still a lot that, that, that, that, that is not there. But, uh, again, and, and let me, let me hedge here. It's not that, uh, it's not that very bad bugs do not happen.

1:05:50

It's that it happens way less than it would at any open source project at this level of maturity. Because again, the simulator is not magic. The simulator is still software, and it has to explore. But what we found is that, like, we're s- we're exploring a pretty large and relevant part of the space of possibilities, and the bugs are not there. So Turso works.

1:06:11

And because we're so confident that Turso works, but at the same time we are, you know, this alpha stage, we came up with this challenge in partnership with Algora that if you go to turso.algora.io, you're gonna see our challenge there. If you find any bug on Turso, not Turso Cloud, you know, Turso Cloud is a separate thing. If you find any b-bug on Turso, the database, that leads to a data corruption, uh, we're gonna pay you $1,000.

1:06:39

Uh, with, with the, with the caveat, I mean, it's not just reporting the bug. You have to improve the simulator so that it catches your bug, uh, and then we g- the, the, the, the instructions are all there. But, like, if you do that, we give you $800, and if you fix the bug on top of that, we give you another $200 for a total of, of $1,000. Uh, those can go to separate people, right? You can just report if you want.

1:07:00

Uh, but we're paying $1,000 per bug, uh, that improve the simulator because we know that, like, once the simulator gets improved, bugs in that area never happen anymore.

1:07:09

Aaron Francis

Mm-hmm.

1:07:10

Glauber Costa

Right? Uh, and $1,000 is not a lot of money, but I still think it's a substantial amount of money for a project that is-- exists for, for less than a year. But our goal is to actually get that to six figures. So I wanna get to the point, and I think we will be confident with, with the deterministic simulation testing-

1:07:26

Aaron Francis

Mm-hmm

1:07:26

Glauber Costa

... that, uh, maybe two years, three years down the road, we're gonna be paying you $100,000, uh, if, if, if you find any bug and improve the simulator to, to, to catch that bug. But again, in, in the alpha stage, uh, things... We know that the, we know the bugs are so... So we're not claiming that our simulator caught all bugs that exist. We're claiming that, uh, there's a large part of, you know, th- there's a large amount of bugs, uh, that they're just, they're, they're just not there.

1:07:54

Uh, we focus a lot our simulating efforts in data corruption. We have not focused our efforts in correctness, so we're not paying you anything for correctness. Uh, but in, you know, we, we cl- if you download Turso today, you're gonna see a claim, "Do not use this in production, it's alpha." But then again, once as it evolves, we wanna in- increase the scope, uh, and we're gonna be paying you the money for, uh, asset violations, correctness issues, uh, incorrect queries and, and all of that, and, and corruption.

1:08:21

Uh, and we're gonna be paying hopefully, uh, hopefully by, until the, be- be- before the end of this year, uh, hopefully I wanna get that to $5,000. Uh, and then hopefully next year we can get that to $10,000. Uh, and, and, and, and the next stage will be getting that to $100,000. So we will get to that point. Uh, again, I think we're not there yet. Uh, but the, the, the deterministic simulation testing framework is what allows us to do, uh...

1:08:46

And, and we actually believe we're gonna end up in, in, in, in even more reliable s-stage in SQLi because it's just, I mean, seeing the success of TigerVito, it just, that's what it does. I mean, it explores a large... You don't have to write tho- tho- those tests. You just explore, uh, and, and, and it, it, it's been fantastic. I mean, we, we've been incredibly happy with that. I don't think we could have had, without this, uh, getting to the point that we're comfortable paying people $1,000 per, per a certain class of bugs in, in, in six months of, of development.

1:09:16

That, that would not have been possible. Uh, and with deterministic simulation testing, we're comfortable doing this.

1:09:21

Aaron Francis

So I, I wanna dive into a few points, but first, has anyone claimed $1,000 yet?

1:09:27

Glauber Costa

Uh, no. Uh-

1:09:29

Aaron Francis

Okay

1:09:29

Glauber Costa

... I am 100% sure that one person will, because like, one, one of the f- one of the things that happened is that, um, when one of those, one of those 64 contributors that show up-

1:09:39

Aaron Francis

Yeah

1:09:39

Glauber Costa

... and are still there with us today, is a guy that's been doing his PhD in deterministic simulation testing. So that's why he actually got so interested in the project. Uh, and, and, and he's a Turkish guy, uh, doing his PhD here in, in America, in the University of Maryland, if I'm not mistaken, uh, Alp. Uh, and he is a, a freaking beast.

1:10:01

So he's actually one of the reasons, uh, uh, why we got to this point so soon because he, he came into the simulator and said, "Man, I'm gonna..." So he messaged me the other day, said, "Glover, uh, just to be clear," uh, "do I, do I, do I-"

1:10:15

Aaron Francis

Am I eligible?

1:10:16

Glauber Costa

"... am I eligible?" I said, "Yeah. Alp, you know, you, you are. In, in fact, we would love to..." You know, uh, he, he doesn't work for Turso, uh, and we would love to, you know, just, uh, give something back to him in, in some way.

1:10:30

Aaron Francis

Of course.

1:10:30

Glauber Costa

So I actually, you know, uh, uh, Alp, if you're, if you're hearing, we decided already that even if you, even if you don't find anything, uh, we'll find a way to, to get you the, the, the prize. I mean, we're gonna, you know, pay retroactively for something you found already. So we wanna, we wanna, we wanna of course, uh, if, w- to the extent possible, reward, uh, the, the amazing work that Alp has done.

1:10:53

Uh, we would not be here without him, and just, just goes to show the power of open source. He has his own motivations, which is to, to, to, to do his PhD thesis. Uh, we have ours, but, you know, through this open contribution community, uh, you can get those two different sets of interests working together. That's why an open contribution community with the high bar that comes from the deterministic simulation testing.

1:11:17

No code goes into Turso that doesn't pass deterministic simulation testing.

1:11:21

Aaron Francis

Mm-hmm.

1:11:21

Glauber Costa

So, so the bar is there, right? Uh, I am sure Alp's gonna find something. I, I am 100% sure that Alp's gonna find something new just, uh, and, and, uh, i- if he doesn't, we'll, we'll pay him anyway. Uh, so, so I'm sure that at least one prize is gonna be paid. Um, and, and, and we're fully expecting some others. Uh, I think the number... I, I think, you know, if you, if you fast-forward six months, uh, Pekka and I are estimating that, that we're gonna be paying between five to 10, hopefully, uh, of, of, you know, because it's alpha.

1:11:52

Uh, and, and at that point, we're gonna be comfortable, uh, bumping, uh... If, if, if we end up paying more than that, I think we're gonna take a step back and, and, and give it more time.

1:12:01

Aaron Francis

Mm-hmm.

1:12:02

Glauber Costa

Uh, I, I, I actually think we're gonna do less than that, uh, you know, just, uh... I told Alp only like, "Alp, just don't bankrupt us, man." You know, just because, uh, it just, uh... But, but I'm sure we're gonna pay, I'm sure we're gonna pay some. It has not happened yet e- even though Alp's been trying, so he has not yet found, uh, uh, we released that, uh, uh, 10 days ago, uh, uh, from the time that we're recording.

1:12:24

Uh, you know, I'm sure he'll find something. It hasn't happened yet, and I'm sure somebody else will, will, will find a couple, uh, as well. Uh, again, it's consistent with our, with, with our idea of the state of the simulator today, which is pretty good, but there's still a lot to do. There's still some crazy combinations that we believe will, will yield bugs. Uh, so, so, so, but, but it hasn't, in 10 days, it hasn't happened yet.

1:12:45

Aaron Francis

Cool. Love that. He's definitely gonna find one. He may sit on it until the prize goes up to $100,000.

1:12:50

Glauber Costa

Oh, man.

1:12:50

Aaron Francis

But he's gonna find something. Um, so, um, a- as, as we're wrapping up here, I wanna just dive into a few of these deterministic simulation things. Um, this sounds incredible.

1:13:01

Glauber Costa

That's amazing.

1:13:01

Aaron Francis

So if I can, if I can, if I can dumb it down just a little and see if I'm still directionally correct. The, this deterministic simulation testing, um, let's imagine we've got a function that accepts, you know, two arguments, right? And we can, as the people who are writing, um, you know, writing the, the simulator boundaries or, like, test case for the simulator, we can say function, function This parameter

1:13:31

A should accept numbers between zero and 10.

1:13:34

Glauber Costa

Mm-hmm.

1:13:34

Aaron Francis

And parameter B should accept a string up to 30 characters long.

1:13:39

Glauber Costa

Mm-hmm.

1:13:40

Aaron Francis

And then the simulator's gonna say, "Okay, zero to 10, huh? What if I pass potato? What if I-

1:13:45

Glauber Costa

Mm-hmm

1:13:45

Aaron Francis

... pass infinity? What if I pass 11?"

1:13:48

Glauber Costa

Mm-hmm.

1:13:48

Aaron Francis

And it's gonna do that, but it's going to not only do that, it's going to do that with both arguments-

1:13:54

Glauber Costa

Yeah

1:13:54

Aaron Francis

... and it's going to do an exhaustive in boundary, out of boundary test, cross-

1:13:59

Glauber Costa

Yeah

1:13:59

Aaron Francis

... testing these both arguments together. Um, and then let's say we pass a seed of, you know, one, two, three, four, and we pass this seed and it runs a million tests and fails on one, we can pass that seed again, and it's gonna run the exact same million tests such that we can run it over and over and over until we fix that particular bug.

1:14:21

So it's testing presumably everything within the bounds, and then all kinds of stuff outside of the bounds, including numbers that are slightly over, but also different data types-

1:14:32

Glauber Costa

Yeah

1:14:32

Aaron Francis

... failures to the disk, all of that kind of stuff. Is that-

1:14:35

Glauber Costa

So, so it, it-

1:14:35

Aaron Francis

... is that directionally correct?

1:14:36

Glauber Costa

Di- directionally correct. So, uh, keeping within this framework, the way to make it, like, f- fully correct is, is the following. Uh, so f- first you're not gonna explore all possibilities, uh, just because it's compute- computationally, uh, prohibitive. So you're gonna randomize, uh, the, the possibilities, right? So, so, uh, a- again, you d- decide, "I wanna run this for this long," and then it's gonna be, it's gonna keep randomizing.

1:14:59

Uh, then, then the other, the other, the other thing that needs to happen is that every time, and, and, and this is the part that's just missing, uh, so the, the, the, the thing that was corrected from what you said is that it's not gonna explore everything because y- you, you can't. Imagine if that had 10 parameters and, and, and those 10 parameters can, can... So it's gonna randomize the, the inputs. Uh, and, and the part that's missing is that for this to work, every time your function does something that does IO, that has to, that

1:15:29

IO has to be replaced with, with this... Because what you described so far is a fuzzer, right? The, the, which is part of, of, of, of how this works, right?

1:15:37

Aaron Francis

Got it.

1:15:37

Glauber Costa

So, so the, the, the, the fuzzer just, just is the, is the component that generates all of this inputs randomly.

1:15:44

Aaron Francis

Right.

1:15:44

Glauber Costa

What the simulator is going to do is that the simulator's gonna replace all the IO that is done in your system by a simulated version of the IO. So ins-

1:15:55

Aaron Francis

Fake the IO.

1:15:56

Glauber Costa

Yeah. And, and that is what allows you, because y- you're not gonna run all-

1:16:00

Aaron Francis

Mm

1:16:00

Glauber Costa

... the tests, right? It's not, "Oh, I run all the tests again," because if you run that test again, and then you do IO in a different way, it, it might not fail. And, and if it fails, it may fail in a different way. So you're not gonna run all the tests until, until that point of the one that failed. You're gonna run just the test that failed now, right?

1:16:19

Aaron Francis

Nice.

1:16:19

Glauber Costa

'Cause imagine, running all the tests again can take 10 hours, so you're gonna run-

1:16:22

Aaron Francis

Mm

1:16:22

Glauber Costa

... just the test that failed. But with the seed, you know all the IO that was generated, right? So imagine, like, you, you, if you're doing this just for a function, and, and, and that function is calling a, like, calling a endpoint on an API, you're not gonna call the endpoint on the API, you're gonna put the simulator there to generate responses randomly, but it ma- but that, and that's the hard part.

1:16:43

The responses have to be randomized, but they have to make sense because you can't-

1:16:47

Aaron Francis

Right

1:16:47

Glauber Costa

... write something to disk and then later respond with, with, with something else, right? It has to m- behave like your system would, but fail in interesting... Because the, the, the, the randomizer is also randomizing the failures in the IO system, right?

1:17:01

Aaron Francis

Mm-hmm.

1:17:02

Glauber Costa

So let's say one time, uh, you call into this API to respond with 35. You're not gonna respond with 32 later j- when, when you get it again because it wouldn't be what the system does, but you might fail, uh, to respond at all in, in certain connections. You may, uh, if you're expecting a JSON payload, you might have this payload tru- truncated.

1:17:23

And, and, right, so, so you start injecting those random failures, but every time you do IO, you no longer do IO through the, your real IO system. Every time you do... A- and, and IO here means everything that is non-deterministic, right?

1:17:39

Aaron Francis

Mm-hmm.

1:17:39

Glauber Costa

So everything that is n- non-deterministic, like, uh, grabbing a timestamp, has to go through the simulator. Uh, talking to, uh, in our case, the storage device has to go to the simulator. Generating random numbers ha- has to go through the simulator. So everything that you do that would have side effects in the system, uh, has to go through the simulator so that when you run that one test out of a trillion that failed, that test will reproduce exactly, right?

1:18:07

And, and then the fuzzer is the component that is generating the inputs in, in, in different ways.

1:18:12

Aaron Francis

So what I described was testing the boundaries of a function.

1:18:17

Glauber Costa

Of... Yeah, what you described was the fuzzer, yeah. So you described the fuzzer-

1:18:19

Aaron Francis

And-

1:18:19

Glauber Costa

... which is a part of this, yeah

1:18:20

Aaron Francis

... so testing the boundaries of that function is, is the fuzzer. The deterministic simulation testing is testing the boundaries of the system.

1:18:29

Glauber Costa

Yeah.

1:18:30

Aaron Francis

The places where it reaches out and grabs other stuff. It's saying, uh, "Read," you know, "read through me, this..."

1:18:37

Glauber Costa

Yeah.

1:18:37

Aaron Francis

"Read through the simulator," and the simulator will return deterministically normal, totally good results, or, "Oops, the disk isn't there. Oops-"

1:18:47

Glauber Costa

Mm-hmm

1:18:47

Aaron Francis

... "you know, the power went out, the network is down," you know-

1:18:49

Glauber Costa

Yeah

1:18:49

Aaron Francis

... whatever. That makes a lot of sense. Okay, so-

1:18:52

Glauber Costa

And then again, more, more than that, e- even if the simulator, because our, the early days of our simulator, we did not have fault injection, right? So I don't wanna make it cle- seem that it's necessary. Even the, even if you don't do fault injection, uh, which is, right, you need, you need that component to make sure that every time you do IO, the same thing happens.

1:19:12

Aaron Francis

Hmm.

1:19:13

Glauber Costa

Right? Because if you're, if you're just running this function, uh, imag- imagine that there, there are those famous bugs that, like, some people joke about it, uh, uh, the bug only happens on a Sunday.

1:19:21

Aaron Francis

Of course, yeah.

1:19:22

Glauber Costa

So, so, so, uh, e- even if you read a timestamp, every time that ti- that test reads a timestamp with that seed, it needs to read the same timestamp to the microsecond Because you need to be able to reproduce that bug. So everything that will create, everything that will make a run be different than another run has to go through the simulator, even if you don't inject any faults, uh, right?

1:19:48

Because you need to make sure that if you run that test again, you can deterministically reproduce everything that happened. But once you have this beautiful thing that is virtualizing all of our, all, all of our, your IO-

1:20:00

Aaron Francis

Mm-hmm

1:20:01

Glauber Costa

... it's yet another boundary where you can, uh, where you can inject some randomness there as well.

1:20:06

Aaron Francis

Oh, this is cool. I love this.

1:20:08

Glauber Costa

Right.

1:20:08

Aaron Francis

I'm gonna have to do some reading on that. That sounds super awesome. So, um, as, as we wrap here, tell us, like, tell us what the next, you know, m- six may be too far. Tell us what the next three months hold for Turso, Turso Cloud, um, and how can people, how can people get involved in what sounds like a, an incredibly interesting project?

1:20:29

Glauber Costa

Uh, people, uh, who are, uh, we... A lot of our early contributors are claim, and, and we talked to all of them, by the way, when, when I was in this process of, like, what do I do with this? I wanted to reach out to those people and talk and under- understand if the signal was, was real or it was just like a, you know, a bunch of people randomly showing up.

1:20:46

Aaron Francis

Mm-hmm.

1:20:47

Glauber Costa

Uh, and what a lot of them said is that, "Man, I love the space. I love databases. I, you know..." And you go contribute to a mature database, uh, it's hard to even find what you contribute. But in, in, in this project, I mean, there's so much to do. Uh, and this is a window of opportunity that is not gonna be there forever. So I, I, I strongly recommend, uh, people in the audience, if you're curious about how databases work, uh, if you wanna contribute to a database where you have opportunities to write a query planner, like

1:21:18

something that you just, in, in, from, from scr- the query planner itself is already wouldn't be from scratch 'cause you is already doing it. But, uh, it, it... Go, go look at the compat matrix. Uh, there's just so much, there is so much to do, right? Uh, w- even though we're progressing fast, I s- I suppose-

1:21:35

Aaron Francis

Mm

1:21:35

Glauber Costa

... that w- in the next six months, we're still gonna have this window of opportunity for people who like databases, uh, who like system programming, uh, to, to really contribute in a meaningful way to a very, uh, uh, i- i- interesting system. Uh, so there's gonna be a lot of that. Uh, we are going to, we are going to be now, uh, we, we believe we support around 50% of what SQLite supports today.

1:21:58

Uh, uh, we wanna get to a beta where we're supporting around 80%, uh, in three months. Uh, and one of the major things that we're gonna be doing is, uh, supports for indexes. So for example, uh, indexes are there in the code but, but disabled by default, so bugs, uh... By the way, if you find bugs, uh, in indexing that leads to data corruption, they do not count, uh, for the challenge because it's a feature that is, you know, we, we haven't blessed yet, right?

1:22:25

So, so, uh, we want... Uh, but, but, but it's, but it's coming. So we want, uh, I think in, uh, another month or two we're gonna support indexes. And now with indexes, a lot of those production use cases can be unlocked, right? So, because without indexes, the database is... Uh, Aaron, you've, you've done a lot of database education. Every time somebody has a performance problem, what's the first thing you look at, uh, in-

1:22:45

Aaron Francis

Always indexes

1:22:46

Glauber Costa

... in, always indexes, right? So, so the moment, the moment , the moment we support indexes-

1:22:49

Aaron Francis

Yeah

1:22:49

Glauber Costa

... this start to become, uh, a, a more serious contender for some workloads. Uh, and we wanna get the overall support to 80%. We also want to, uh, support at least one major feature, uh, that SQLite does not support. Because again, uh, if you just support 80% of SQLite, uh, w- it's not there yet, right?

1:23:09

Aaron Francis

What's the point? Yeah.

1:23:10

Glauber Costa

What's the point? Uh, and we wanna give people a reason to use Turso sooner rather than later. So in parallel with that, we're also, uh, going to be... Uh, and there are three things that we're working on right now. Let's see. Uh, uh, we believe at least one, uh, will be, uh, in, uh, for the beta, in, in good shape enough that it will become a, a major feature. Uh, one of them is just concurrent writes, which is, you know, on, on the one hand is everything that people complain about SQLite.

1:23:35

80% of the complaints are, are around concurrent writes. Uh, so we're working on that already. It is also a very hard thing to do, so will it be ready in three months? We do not know, but we are actively working on it. The second thing is, uh, better schema changes. Uh, and better schema changes also mean more performance schema changes because perform, uh, uh, SQLite is very slow, uh, with schema changes today.

1:23:57

We wanna, we wanna make it better, uh, and we wanna make it more capable. It's also very hard, uh, so we don't know exactly where we're going to be at that point. The third one is, uh, it's actually simpler, so that is the one that I'm betting that we're gonna have for sure in three months, which is CDC. Uh, something that a lot of people also ask for in the Turso Cloud, how do we get access to what changed, uh, in, in, in SQLite since, uh, a moment in the past?

1:24:20

Uh, that is actually, uh, already, uh, uh, merged to the tree. Uh, and-

1:24:25

Aaron Francis

Ooh

1:24:25

Glauber Costa

... and we're gonna have a release, hopefully having CDC in, in a couple of days. Uh, at which point if you find data corruption, uh, in CDC, uh, you, you can get $1,000, right? So, so, uh, those three things are things that we're working on that SQLite does not have. Uh, so we wanna have at least one of them in a very good, in, in very good shape. CDC will, will, will take, you know, a couple of months still to stabilize-

1:24:47

Aaron Francis

Mm

1:24:47

Glauber Costa

... right? Uh, and, and, and around 80% of SQLite does. Uh, and at that point we're gonna call it beta, uh, and then, uh, we, we're gonna go from there.

1:24:56

Aaron Francis

Wow. Exciting times.

1:24:58

Glauber Costa

Right.

1:24:58

Aaron Francis

I, I, I like this. I like this roadmap. So if y'all are listening and you wanna get in, uh, get in on the ground floor of a, a database right now, now is your time, uh, to get over there and put into practice maybe some of the stuff you know theoretically.

1:25:12

Glauber Costa

Yeah.

1:25:12

Aaron Francis

Sounds like-

1:25:12

Glauber Costa

Yeah

1:25:12

Aaron Francis

... it sounds like a lot of fun. Um, tell the people where they can find you, um, and how they can reach out.

1:25:20

Glauber Costa

So, uh, how to find me. If you wanna find me physically, I am in Richardson, Texas.

1:25:26

Aaron Francis

Yeah. Right down the street from me.

1:25:27

Glauber Costa

15-

1:25:27

Aaron Francis

You can find us both.

1:25:29

Glauber Costa

15 minutes away from Aaron. Uh, so if you are in, in the area and would love to talk databases, if you have use cases for SQLite, uh, I'm even, of course, even more incentivized to do so. Would love to meet. Uh, uh, on X, I am GL- CST, uh, just the most of the consonants in Glauber Costa. Uh, so G-L-C-S-T is my handle.

1:25:51

Uh, I'm on LinkedIn as well, uh, and I am on the Turso Discord, which is T-U-R.S-O, Turso/discord. Uh, so you can join our Discord there. Uh, and, and, you know, always, uh, I'm always happy to chat with everyone. Uh, I'm a very active person on, on our Discord. Now, a little bit less than, than before, just, uh, due to the personal circumstances of, of my life.

1:26:14

Uh, but I'm very active on, on our Discord as well, so always happy to chat with people there.

1:26:19

Aaron Francis

Awesome. Well, this, this has been, this has been fun. Uh-

1:26:22

Glauber Costa

And, and of course, uh, github.com/tursodatabase/tursodb, uh, which is, uh, Turso the embedded database.

1:26:31

Aaron Francis

Perfect. I'll leave, I'll leave links to all of that down below. Um, and if y'all are listening on audio, there's a, there's a YouTube channel, and if you're listening on YouTube, there is an RSS audio channel if you wanna throw it in your podcatcher. Um, Glauber, thank you for doing this. Um, I'm sure that I will see you soon. We have to tell, we have to tell the, uh, the listeners that, uh, your wife made incredible apple pies for us.

1:26:56

Glauber Costa

Oh, yeah.

1:26:57

Aaron Francis

And so we, uh-

1:26:57

Glauber Costa

She's a, she's a, she's a chef.

1:26:59

Aaron Francis

Oh.

1:26:59

Glauber Costa

You will notice that I have all sorts of books here in my background. A lot of them are bakery books 'cause, you know, she... My wife actually went to, uh, Le Cordon Bleu in Fr- in Paris.

1:27:08

Aaron Francis

Oh, wow.

1:27:08

Glauber Costa

Um, and I gained a lot of weight, uh, since then. Uh, you know, I've, I've always gonna struggle. Uh, she ba- she, she bakes all sorts of, uh, of amazing things. A lot less now, but, you know, she, she, she's just the best.

1:27:18

Aaron Francis

Well, she... Y'all came over for-

1:27:21

Glauber Costa

Yeah

1:27:21

Aaron Francis

... to, all the kids to hang out, and she walked in with these two apple pies, and apple pie is my favorite.

1:27:25

Glauber Costa

Yeah.

1:27:25

Aaron Francis

And I kid you not, this is not flattery, best apple pies I've ever had.

1:27:29

Glauber Costa

Yeah.

1:27:29

Aaron Francis

So make sure we show her that.

1:27:29

Glauber Costa

And, and home-homemade ice cream as well. Yeah.

1:27:31

Aaron Francis

Oh, dude.

1:27:31

Glauber Costa

She, yeah.

1:27:32

Aaron Francis

The best. So whenever, whenever new bébé comes-

1:27:35

Glauber Costa

Yeah

1:27:35

Aaron Francis

... we'll come over with a bunch of food and feed y'all-

1:27:37

Glauber Costa

Awesome, man

1:27:37

Aaron Francis

... in return. But thank you.

1:27:38

Glauber Costa

I'm looking forward-

1:27:39

Aaron Francis

Thank you for doing this. Thank y'all for listening, and we will see you next time.

1:27:43

Glauber Costa

Thanks, Aaron.

1:27:45

Aaron Francis

Bye.

Databases

More videos on databases

All videos

Get the next one by email

I’ll send you some more. Not too many.

Join 7,500+ other readers.

Read past issues