← See all notes

Table of Contents


Potentially useful extensions

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 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;

https://kerkour.com/sqlite-for-servers / https://archive.is/Xfjh6 https://use.expensify.com/blog/scaling-sqlite-to-4m-qps-on-a-single-server https://blog.wesleyac.com/posts/consider-sqlite https://avi.im/blag/2021/fast-sqlite-inserts/

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


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