core
core copied to clipboard
Experiment with a custom Kysely SQLite dialect
trafficstars
June 2025 update: This is probably not necessary for now. Synchronous SQLite with good indexes shouldn't really be an issue for a typical small-scale server. It's not great that it blocks the main thread, but it's not the most urgent problem either.
In particular:
- Support async transactions
- Connection pooling (async transactions requires using other connections for other requests)
- Reusing most recent prepared statement especially for repeated inserts
This has one big downside for the tests: connection pooling prevents using a named in-memory store with better-sqlite3.
To explore:
- Can we use libsql like this? AFAICT the official libsql dialect for kysely is outdated and has serious bugs.
- Execute queries on worker threads to allow JS to run while queries are in progress.