← See all notes

Table of Contents

SQLite

Potentially useful extensions 🔗

Backups 🔗

Optimizing SQLite for servers 🔗

You need to know to run it in WAL mode and be careful to wrap your write operations in short transactions - do that and it’ll handle pretty much anything.

pragma auto_vacuum = incremental;
pragma journal_mode = WAL;
pragma busy_timeout = 5000;
pragma synchronous = NORMAL;
pragma cache_size = 1000000000;
pragma foreign_keys = true;
pragma temp_store = memory;
create table if not exists markets (
    -- This only takes up 1 byte, since integer size is flexible in SQLite
    "is_open" int not null check ("is_open" in (0, 1))
) strict;

Consider using without rowid if the primary key is not an integer 🔗

https://www.sqlite.org/withoutrowid.html

Choosing whether to use without rowid in SQLite tables depends on the specific requirements of your application. without rowid tables are a feature of SQLite designed to optimize storage and performance under certain conditions, but they are not universally beneficial. Here are key points to consider:

When to Use without rowid 🔗

When NOT to Use without rowid 🔗