The Untold Story of SQLite
corecursive.com
corecursive.com
Richard is a great story teller and adventures that SQLite has taken him on pretty interesting. I think he in on hn as well ( @SQLite).
One interesting thing I found about how SQLite is developed is the amount of testing that is done. Between unit tests and parameterized tests and fuzzer tests they are doing billions of tests per release and spending days running them before each release. I know I don't like to wait for a long CI build before I deploy a service but something like SQLite needs whole different category of resilience.
Originally the idea was to give some platform to the areas of computing I was interested in, heavy use of types and functional programming but I think I really found my place as a podcast when I started to focus on peoples stories. So rather than tell me about SQLite, it is tell me about the story behind creating SQLite.
You are doing so great, favorite podcast by far!
It doesn't have to be "implicit criticism", but an open mind doesn't blindly accept stuff, ask for justification.
Yes. Fossil is not only the VCS for SQLite, Fossil is also built around SQLite. SQLite is a core component of Fossil. Thus, when I am working on Fossil, I am forced to interact with SQLite as a "user" instead of as a "developer". In geek-speak, it forces me to "eat my own dog food". This, in turn, prompts me to add needed features to SQLite and more generally to make the SQLite interfaces friendlier to application-developers.
One recent example: SQLite version 3.34.0 added the ability to include two or more recursive terms in a Recursive Common Table Expression. (See item 2 in https://www.sqlite.org/releaselog/3_34_0.html and subsequent links.) This feature was added specifically so that I could more easily write SQL statements that would walk the Fossil version history DAG, as described by the https://www.sqlite.org/lang_with.html#rcex3 link.
I did not develop Fossil with this "dogfooding" idea in mind. It was an unanticipated benefit of Fossil. But in the end, I think it might have been the most important benefit of using Fossil instead of some other VCS.
Not included in the interview is a discussion we had about types. I really think SQLite should be stricter in enforcement of types and Richard doesn't buy it. I may include it in a future bonus episode but the reason I cut it was it didn't really include any details about story of SQLite, it was just two people disagreeing about types. I've done a lot of episodes about types in the past and I wanted this to be about build SQLite, and not about types.
I'll check your hosted episodes on Software Engineering Daily now!
I'm going to have to dig to see if he describes somewhere why Fossil is such a great fit for SQLite.
* immutable
* built in first-class ticketing system
Happens to use SQLite as its storage engine too (SQLInception?), which brings at least a couple (off the top of my head) features:
* SQL is used to query things, which is very powerful
* the repository is a single SQLite file. Easy to store, copy, and…
* one can checkout multiple working copies into various directories. Or, in other words, I can have three discrete, independent workflows happening simultaneously, but only one copy of the repository backing them all.
It’s also got a built-in server that you can use locally or publish for remote people to access via their web browser that’s essentially GitHub-in-a-box.
Also… (kidding. I’m just going to stop here).
Edit: formatting
The git workflow in the docs (https://git-scm.com/docs/git-worktree) looks really clunky.
Here’s what I do in fossil:
$ cd ~/work/project_x
$ fossil open ../fossils/projx.fsl (Edit, edit, edit)
$ fossil ci -m ‘descriptive msg’
(Get an idea, but for whatever reason do not want to disturb this directory)
$ mkdir ~/work/radical_idea
$ cd ~/work/radical_idea
$ fossil open ../fossils/projx.fsl <*note here there is no sense of this being an inferior or “sub” checkout*> (Edit, edit, edit)
$fossil ci -m “cool idea” —branch cool_idea # commit work to new branch
(Test..)
$ fossil co trunk #switch branch back to trunk
$ fossil merge cool_idea #merges our work from cool_idea branch into trunk branch
$ fossil ci -m ‘merge [cool_idea] for radical new feature’
$ fossil close # this working dir syncs everything necessary to the repo (../fossils/projx.fsl) and is now essentially “offline”
$ cd ..; rm -fr radical_idea
$ cd project_x (Note: this working directory now not a tip of trunk anymore…)
$ fossil update # now up to speed (Continue hacking…)
In Git, that'd be:
$ cd ~/work/fossils/projx.git
$ git worktree add ~/work/project_x master # add a worktree with the 'master' branch checked out
$ cd ~/work/project_x
(Edit, edit, edit) $ git commit -m 'descriptive msg'
(Get an idea, but for whatever reason do not want to disturb this directory) $ git worktree add ~/work/radical_idea -b cool_idea # add a worktree with a new 'cool_idea' branch
$ cd ~/work/radical_idea
(Edit, edit, edit) $ git commit -m "cool idea"
(Test..) $ git switch master # whoops, can't do this
fatal: 'master' is already checked out at '~/work/project_x'
$ # let's just do the merge in the other worktree, since we're about to switch anyway
$ cd ~/work/project_x
$ git worktree remove ~/work/radical_idea # or: rm -rf ~/work/radical_idea && git worktree prune
$ git merge cool_idea
(Continue hacking…)There is not in worktrees either. You can use worktrees with a bare repository for instance. It's just that for backwards compatibility and the convenience of most users a non-bare clone creates a default worktree. That's exactly what you see if you `git clone` a repository then `git worktree list`, a worktree corresponding to the working copy.
Also quite interesting the general comparison: https://fossil-scm.org/home/doc/trunk/www/fossil-v-git.wiki
Both sites are written from Fossil guys, so they may not be 100% neutral.
But fossil is a pleasure to work with, especially on Windows, because a) it comes as a single executable that one can just copy to another machine, and b) it does not require ssh or anything else to be installed.
The web interface is amazing, especially considering the size of the executable file.
Of course, it was a bug with my wrapper (included a \0 char at the end of strings).
I just forwarded him the link to your podcast, saying "we really had no chance"
The newsletter will come out once a month when there is a new episode and has a bit of personal take on the episode and maybe some links to other things I've been up to.
If you just want a pure notification, I'm sure you could hook the RSS feed up to an RSS to email service. Thanks for listening!
While they're keeping those tests proprietary, and relatedly have a closed development model, this strikes me as still better than typical open core strategies for monetizing free software, or at least pointing in better directions.
Agbell, since you're here, could I ask you add a standard link to the RSS feed for your podcast?
<link rel="alternate" title="Corecursive" type="application/rss+xml" href="https://link.chtbl.com/corecursive?platform=rss" />
Minor nitpick: technically, the primary company that supports SQLite is an incorporated partnership named Hipp [ed note: yes, that's Mr. Richard Hipp], Wyrick [ed note: Hipp's wife] & Company, Inc. dba Hwaci (https://www.hwaci.com/).
Emphasis here?
Counter-argument moving vms to different providers, ips etc is a lot more straightforward so maybe they don't "control" your mail..?"
And a third way of looking at is every mail has two endpoints. You don't control the server of who sent it to you or who you send it to. Google does. So they still control your mail..?
Dr.Hipp mentioned GMail bouncing email sent to him - but hosting email yourself, will just move you to a different side of the bounce - now GMail will be bouncing emails sent by you! See, for example, first comments on the recent HN thread here: https://news.ycombinator.com/item?id=27707857 (ctrl+f for "pain in the" if it's not the first one).
So it looks like convincing GMail to respect your small server is a non-technical problem, which might be an issue for a person with "only engineering" mindset. On the other side, Dr.Hipp looks like a right person to try to convince GMail to respect smaller mailservers!
On the other hand, AT&T is most definitely a problem. They run their own internal RBL, and the best I can guess is that they're blocking Linode. Any mail I send to an AT&T customer gets bounced, and forwarding that bounce to the address they indicate it should be sent to to get delisted accomplishes nothing.
This is also a good reason to keep a VPS even if you aren't using it at the moment: it keeps the IP "clean" so that when you put it back into use, it is useful, as opposed to (possibly) some random IP that up until a month ago was spammer central.
That won't protect you from the block getting on a blacklist though.
This is impressive for Postgres.
SQLite is incredible. I've used it over the years in a variety of important projects.
A couple of years later sqlite was everywhere. It was exactly what I had in mind (but with nowhere enough skills to do it myself).
Back in 2016 we were struggling with management of separately-hosted SQL Server instances (network, firewall, user accounts, license, explaining shit to customers, etc.) Installing our software in a new customer environment would take days because of all of the extra mechanics involved. There were 8+ other windows services as well.
Fast forward to 2019 - We now use SQLite embedded inside the application instance. The entire system has been collapsed into a single binary distribution & service. Deploying our software to a completely blank windows server involves emailing the customer a ~120 megabyte zip file, asking them to extract it to C:\myapp and run sc.exe install.
This shift in how we manage persistence of business data allowed for us to salvage an otherwise completely lost ship. Our team is still incredibly small (<10 employees), and we are responsible for managing hundreds of customer environments. If we didn't have a reliable, self-contained persistence mechanism that "just works", we wouldn't have time to do anything else of value.
Hehe, nice test for their email servers & antivirus (which probably wants to unpack it to see if any nasty payload is included) :)
I did it mostly for the built in project management (wiki, bug tracking), and to get away from the big SaaS environments. But the sqlite binary file repo sold me on the architecture quickly.
Dr. Hipp is a fantastic software engineer and product designer. Both SQLite and Fossil do what they need, have only the bells and whistles needed, and have clean, consistent designs. I've browsed the source for SQLite before, and it's also clean, legible, and quality.
https://softwareengineeringdaily.com/2015/11/13/sqlite-with-...
Dr. Richard Hipp is truly an inspiration.
Interesting to hear that SQLite is supported on the A350 for life service life of the design.
And Microsoft contracting for changes for Windows 10 bundling? That's shocking, considering how many small databases they have developed or purchased over the years.
Hmmm, worldcat says the nearest library with a copy is several hundred miles away. I wonder if I can ILL it...
That'd be an awesome contribution to open source, particularly at a time that there's a lot of collective awareness of how hard it is to secure C programs.
(There's probably still a business reason to keep it proprietary: it's a reason for people to go to them for changes, at least if they want the final product to be thoroughly tested. Alas, 'cause it would be cool to see.)
It's funny that he references preppers, survivalists, and dependency on society near the end, when talking about writing all of your own software dependencies. A while back someone thinking about it from the other end (i.e. saying we generally should accept some dependencies) said almost exactly the same thing in thread at https://twitter.com/hdevalence/status/1214234305754329088 . I draw no deep insight from this, but fun to see the same analogy from two very different perspectives. (Kind of closing the circle, the "let's be real about dependencies" article linked, https://wiki.alopex.li/LetsBeRealAboutDependencies , mentions in passing "SQLite is basically everywhere (for good reason)".)
> Fortunately, I didn’t know any experts and so I did it anyway
He obviously lives by a certain ethos of self-reliance so not sure he would have talked to experts if could.
But makes me wonder: given it so easy now to find the experts compared to 2000, to google what they think - it is easier to get discouraged?
Sequelite vs Sequel-lite
How does creator pronounce it in podcast?
No, it is a destroyer, see https://www.surflant.usff.navy.mil/ddg79/. Other than Hollywood, no one had built a battleship since around the end of WWII.
When I interviewed Brian Kernighan one of his complaints was how so much of modern programming is just looking things up rather than building things and I think that Richard has escaped that fate by building things himself.
I’ve never spent much time with SQLite directly. My main interaction has been through Django and the ORM layer.
My day job uses a custom object database. While I’m familiar with SQL and relational DB concepts I haven’t worked heavily with them.
BUT: you probably need 1k+ or 10k+ requests per second to start getting advantages
https://news.ycombinator.com/item?id=27671376
is this comment:
https://news.ycombinator.com/item?id=27673359
"We're currently transitioning from a multi-tenant 2TB postgres DB hosted on AWS RDS to using sqlite instead, a separate database for each client.
We're doing this for multiple reasons:
a) As our DB grew the service became very expensive, one of the biggest items in our AWS invoice;
b) Keeping the PG servers up to date is a pain, we simply don't have time for this;
c) We wanted to be able to migrate to other clouds and even be able to offer a self-hosted version of our platform."
In interview:
"The idea for SQLite actually came out of his frustrations with an existing database called Informix that was installed on a literal battleship."
"Why do we even need a server? Why can’t I pull this directly off the disk drive? That way if the computer is healthy enough, it can run our application at all, we don’t have dependencies that can fail and cause us to fail, and I looked around and there were no SQL database engines that would do that, and one of the guys I was working with says, “Richard, why don’t you just write one?” “Okay, I’ll give it a try.” "
Easily the most important take away in this excellent interview, but unfortunately, also the most contentious.
Great! Pick up a gun then!
Or maybe, the whole, "legislation is curbing everyones freedom!" thing is just a lie, fed to you by the most wealthy and powerfull to keep you from voting in a way that protects your freedom, and curbs theirs.