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
Locked video

Please purchase the course to watch this video.

Video thumbnail
Optimizing SQLite
Faster inserts

Full Course

$
179
$229
USD, one-time fee
Whether you want to learn SQLite from scratch or just want to level up your game, High Performance SQLite is by far the best course out there. I've been using SQlite for over a decade now and still managed to learn a lot from this course. It's a fantastic investment and a no brainer.
Kulshekhar Kabra
Kulshekhar Kabra

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

When inserting large amounts of data, I found two tips that can make it faster. First, I can set pragma synchronous to off for a speed boost, but there's a risk if power fails. Second, I can group many inserts into a single transaction, which speeds things up without added risk.

Video Transcript

I wanna give you 2 parting tips for inserting huge amounts of data. So maybe you're doing some sort of import or you're seeding the database locally or whatever it is. If you're inserting huge amounts of data, 2 things can make it faster. First thing, if you are risk tolerant, you can set pragma synchronous to off and that's gonna go a lot faster. If you have a power outage in the middle, you might run into some trouble.

The second thing that doesn't require risk taking but will speed up your inserts is bunching a bunch of inserts into a single transaction. So instead of running a 100,000 individual inserts, group them into transactions of, I don't know, 500, a 1000, whatever, Group them into transactions because then the transaction commit will be amortized across all of those inserts and it can speed it up. It can make it a lot faster instead of having to begin a transaction insert and commit every time. This makes a much bigger difference on spinning Rust versus a solid state drive. So depending on what drive you have, grouping all of those inserts up and wrapping them in a transaction, chunking them out into transactions can really really speed up your insert time.

So between pragma synchronous off and grouping a bunch of inserts into a transaction, those can be ways to load data a lot faster into Equal light.