High Performance
SQLite
Introduction
Introduction to this course
Introduction to SQLite
SQLite is safe
It's just a file
Running SQLite locally
Good uses for SQLite
SQLite's limitations
The documentation
SQLite Internals
SQLite's structure
SQLite's file format
Dot commands
Pragmas
Virtual tables
Schema
Flexible types
Types
Strict types
Dates
Booleans
Floating point
Rowid tables
Auto increments
Without rowid
Generated columns
Optimizing SQLite
Locking
Rollback mode
WAL mode
WAL vs Journal benchmarks
Busy timeout
Transaction modes
Vacuum
Analyze & Optimize
Suggested pragmas
Faster inserts
Indexes
Introduction to indexes
B+ trees
Primary, secondary, and clustered indexes
Without rowid tables
Benchmarking without rowid tables
Imposter tables
Primary key data types
Where to add indexes
Index selectivity
Composite indexes
Composite ordering
Covering indexes
Partial indexes
Indexes on expressions
Automatic indexes
Duplicate indexes
Indexing joins
Advanced SQL
Explain
Index obfuscation
Joins
Subqueries
Unions
CTEs
Recursive CTEs
Window functions
Dealing with NULLs
Row value syntax
Indexed sorting
Upserts
Returning
Aggregates
Triggers
Operating SQLite
Altering schema
Altering schema with tools
Multi-database
Multi-tenancy
Backups
Exports
How to corrupt SQLite
Advanced JSON
Intro to JSON
JSON vs. JSONB
Argument types: path, value, JSON
JSON5
Valid JSON
Creating JSON objects + arrays
JSON Extraction
Updating JSON
JSON aggregates
JSON table functions
Indexing JSON
Full Text Search
Creating FTS tables
Performing searches
Ranking results
Highlighting matches
Bonus Interviews
DHH discusses SQLite in Ruby on Rails
Distributed SQLite with Litestream and LiteFS
Offline-first, multiplayer SQLite
Production SQLite with Turso and libSQL
Migrating from Postgres to SQLite with Kent C. Dodds
Ruby on Rails with SQLite
Moving from Redis to SQLite with Mike Buckbee
Next video (8)
Introduction
Running SQLite locally

Full Course

$
179
$229
USD, one-time fee
This is by far the best course on SQLite out there, Aaron put a lot of effort into it to explain the ins and outs of this fantastic database. Highly recommend it!
Alexandru Vladutu
Alexandru Vladutu

SQLite for Production

Build with and integrate SQLite into your production applications.

Test Data

I've made my test data available for you to use and follow along.

Download
or
Use on Turso

Summary

Running SQLite on a computer is straightforward—especially on Apple devices where it’s often preinstalled. Using Homebrew makes it easy to install an updated version, enabling support for extensions and in-memory testing. It’s a good idea to check your current SQLite version and use Homebrew if you want more flexibility and up-to-date features.

Video Transcript

The title of this video, or at least the title I have planned for this video, is running SQLite locally which, I gotta be honest, is kind of a lie because you're not running anything. Right? There's no server to keep up or to run or to start or to stop. It's just a library, but running SQLite locally is a good video title. Every Apple computer, every Mac comes with SQLite already installed.

If you don't have it on whatever machine you're running on, it's very easy to get. I have actually gone ahead and used brew, homebrew, to install SQLite here. I'll show you why here in a second. But let me just start by showing you which SQLite 3. You can see I am using that homebrew version.

If we were to say SQLite 3 version, it would show you I'm using 3.46 which is May 23rd of 2024. To get in there, you just say SQLite 3, you see that same version again, and you see that you're connected to a transient in memory database. You know, single lite is just a file but sometimes it's not. Sometimes it's just transient in memory which is so cool to me and a great, honestly this is a great use case for for running your tests. You don't have to create a new file.

You can just use an in memory database. Let's get out of here. We'll come back to this later, but for now let's get out of here. If you want to install with homebrew you can just do brew install SQLite 3. There might be a cask you have to add.

The docs the docs will tell you that. You can also get the pre compiled binaries from the SQLite, website. You can see here's our favorite word, the amalgamation. The amalgamation is everything an application needs to embed SQLite. This their chosen flavor of SQLite.

You can add extra extensions in but this is the one that they have chosen to ship. So Android, Linux, Mac, Windows, dotnet, WebAssembly, something else. You can see all of the different, ways that they have compiled it for you which is kinda awesome. One thing I will say about the, SQLite version that ships with your Mac is it doesn't have the ability, it wasn't compiled with the ability to load extensions. That's why I switched from the one that came pre compiled, or came installed with my Mac OS.

I switched to the brew version, the homebrew version, because I can install or add extra extensions to that and it's more up to date. You might check the version that's running on your local machine and see if it's up to date or out of date. If you're running the default that came with your Macbook or your otherwise Apple computer, you're not gonna be able to install extensions. I would recommend using homebrew or getting it off the SQLite website.