r/sqlite • • 4h ago

Omasql: a small, keyboard-first SQLite browser and SQL editor for Linux

2 Upvotes

Think DB Browser for SQLite or TablePlus, but small, fast to start, and driven from the keyboard.

Omasql is a small Qt 6 / C++ app: SQL editor with autocomplete, schema

browser, results grid, row inspector. It follows your Omarchy theme and

language live, and everything is on the keyboard.

Some things I use every day:

- Ctrl+Enter runs the statement under the cursor, Esc cancels it

- Autocomplete knows your tables, columns and aliases (o.)

- Ctrl+click a foreign key to jump to the row it points to

- Ctrl+F filters the results as you type

- Ctrl+. sends a failing query + error + schema to your `omarchy default agent`

(Claude/Codex) and puts the fix in place for you to check

- Export as CSV, JSON, Markdown table or INSERT statements

https://github.com/FabianJ-L/omasql

MIT licensed. It's early (0.3.0), so feedback and bug reports are very welcome.


r/sqlite • • 20h ago

Cuckoo filter w/ xxHash3 beats SQLite in performance by ~120x times!

Thumbnail reddit.com
0 Upvotes

r/sqlite • • 2d ago

Lesson from a metrics exporter: WAL mode alone didn't stop "database is locked", BEGIN IMMEDIATE did

4 Upvotes

I wrote a small Prometheus exporter that keeps a rolling 24h buffer of scrape samples in SQLite, with one writer goroutine and a few HTTP handlers reading for a debug endpoint. Even with journal_mode=WAL and busy_timeout=5000, I kept getting occasional SQLITE_BUSY errors right at the moment a handler tried to upgrade a deferred read transaction into a write to mark rows as exported. The cause was the deferred transaction itself: when a read transaction tries to become a write transaction and another connection has already written, SQLite returns BUSY right away instead of waiting on the busy handler, because waiting could deadlock. Switching every write path to BEGIN IMMEDIATE (via _txlock=immediate in the mattn/go-sqlite3 DSN) made the errors go away, and p99 write latency barely changed. Is there any good reason not to default to IMMEDIATE for anything that might write, or is that just the accepted pattern now?


r/sqlite • • 2d ago

Could .NET database development move toward Write Less. Build More?

1 Upvotes

I've been exploring this idea through EFX. It's still an early experiment, with basic model discovery, SQLite schema comparison, and a review-before-apply sync workflow.

But what I'm really hoping to achieve in the future is something much bigger:

Making everyday database development feel simpler. Less setup, less boilerplate, and fewer steps to get things done, while keeping developers in control.

Write Less. Build More.

That's the dream behind EFX. I'd love to see how far this idea could go.

What do you think is the most unnecessarily complicated part of database development in .NET?


r/sqlite • • 3d ago

Belay - formal verification for SQLite statements

Thumbnail vihren.dev
7 Upvotes

Hi,

I am working on a tool that allows you to do formal verification of your SQLite statements, queries and transactions. Basically this means that you can prove something about your statement and then this means that the statement will always work as expected, no matter what data your database has. This is much better than tests which can only verify the behaviour of a statement for a specific database state.

For example now you can state: Migration M preserves the output of a query Q. Then you can ask your agent to write a proof of this statement. The proof can be checked by the Lean proof checker, and if it is correct, you know that the claim will hold for any database you run it on.

This approach can work on basically any claim you can think of. For example right now I'm implementing UX to claim that a certain transaction is idempotent.

The core of this project is a semantic model of Sqlite in Lean. Essentially thes is a rewrite of part of sqlite in lean. As long as this semantic model matches actual sqlite behaviour we can trust that our claims will hold. The model is currently checked against SQLite using a large number of tests, most of which taken from the sqlite test suite.

This is a very early proof-of-concept. I need feedback from the community how to make it better. Tell me what checks you would like to run on your DB statements and I'll make it easy to do them with Belay.


r/sqlite • • 2d ago

Design question for an open-source local-first database: one SQLite database on OPFS, several browser tabs, and iOS freezing them

1 Upvotes

Hey, I'm building NoCentralDB, an open-source local-first database, and I'd like feedback on its design before the first release. We build it because AI agents work much faster and cheaper when they read data from a local copy: an agent may read hundreds of records in one task, and every read that needs no network costs no round-trip and hits no server rate limit. In the browser, that local copy is SQLite compiled to WebAssembly, stored in the Origin Private File System (OPFS). RFC 0001 has the whole design on one page; this post is about a problem only the browser has: several tabs of the same app sharing that one database.

Natively, SQLite solved this long ago: in WAL mode, one writer and many readers share the file. In the browser, the fast OPFS backend, the opfs-sahpool VFS, takes a synchronous access handle for every file of its pool, and those handles are exclusive. So until now, one tab's worker held the database for the whole session, and every other tab sent its reads and writes to that tab.

That works until iOS freezes the owning tab. WebKit doesn't reliably fire visibilitychange before it suspends a page (WebKit bug 207256, open since 2020), and closing a tab from the tab overview fires no event at all (bug 205942). A suspended page keeps its Web Locks, and in our tests WebKit released a worker's OPFS handles only once its page ran again. Every other tab waits in the meantime: its writes, opening the database, the sync.

The design we chose, and haven't built yet: no tab owns the database any more. Each tab takes it for one transaction under a Web Lock: resume the pool, run the transaction, pause the pool, release the lock. Think of the lock as a single checkout queue; every tab gets the database for exactly one transaction and goes to the back. A frozen tab then blocks the others only if it froze in the middle of a transaction.

We looked at wa-sqlite's OPFSCoopSyncVFS first. It keeps its handles after a transaction and gives them up only when another tab asks, and a frozen tab can't answer; TanStack DB issue #1883 is exactly that hang.

The price, measured in WebKit: a small write costs about 8 ms through our Rust port of the VFS, 5 ms through the official build, against 1.5 ms with the handles held for the session. (Five times slower per write, so that one frozen tab can't stop all the others.) And before each transaction, a tab has to find out whether another tab wrote since its last turn, and bring its in-memory state up to date.

If you've run SQLite on OPFS across several tabs, especially on iPhones: did frozen tabs hold your handles too, and what did you do about it?

RFC 0001: https://github.com/nocentraldb/nocentraldb/blob/main/docs/rfc/0001-nocentraldb.md Multi-tab storage in detail, RFC 0012: https://github.com/nocentraldb/nocentraldb/blob/main/docs/rfc/0012-multi-tab-browser-storage.md Feedback: https://github.com/nocentraldb/nocentraldb/discussions/categories/rfc-feedback


r/sqlite • • 2d ago

I built a free, open-source SQL & database internals guide with an in-browser WASM SQLite 3 Workbench

1 Upvotes

Hey r/sqlite!

I built SQL in Depth — a free, open-source interactive textbook and playground for SQL & database internals that runs directly in the browser with no signup or local setup needed.

Since this community appreciates SQLite, here's what's built around it:

• In-Browser WASM SQLite 3 Workbench: Write and run real SQLite queries client-side with preloaded datasets, schema inspection, and instant query results.

• Relational Visualizer: Step through how joins, grouping, filtering, and window functions transform tables row by row.

• 36 Interactive Database Internals Simulators: Visually explore B-Trees & B+ Trees, WAL vs rollback journals, query planners, index scans vs full table scans, MVCC, and locking behavior.

• 180 Structured Units: Covers everything from core SQL and schema design to indexing strategies, transactions, and storage engine mechanics.

Live site: https://sql-in-depth.vedgupta.in

GitHub (open-source): https://github.com/innovatorved/sql-in-depth

I'd love any feedback from SQLite folks — especially on SQLite-specific quirks, STRICT tables, WAL mode details, or interactive labs you'd like to see added!


r/sqlite • • 3d ago

How a read buffer changes the result of a 100-migration SQLite benchmark in Go

2 Upvotes

I maintain Go-Gen-Ecosystem/go-migrate. I compared v1.0.1 with golang-migrate/migrate v4.20.1 and pressly/goose v3.30.1. Each library applied the same 100 SQL migrations to a fresh SQLite database. Each migration created a table and inserted one row.

On Linux/amd64 with Go 1.26.11, the median allocated per batch across six samples was 727.8 KiB for go-migrate, 10.66 MiB for golang-migrate, and 1.14 MiB for goose. Goose made the fewest allocations at default settings, with 8,547 per batch compared with 9,420 for golang-migrate and 10,873.5 for go-migrate.

I repeated the golang-migrate benchmark with one change. Setting gm.DefaultBufferSize = 4096 at the start of its benchmark, down from the 100,000-byte default, brought its median to 892.2 KiB on these small files. All three libraries used in-memory migration sources, the same pure-Go SQLite driver, WAL, and synchronous=OFF.

To reproduce the defaults from a disposable v1.0.1 checkout, run the following. The tagged benchmark module needs -mod=mod to refresh its dependency metadata.

cd benchmarks/compare
GOWORK=off CGO_ENABLED=0 GOTOOLCHAIN=go1.26.11 go test -mod=mod -run '^$' -bench '^BenchmarkUp100_' -benchmem -count=6 .

Benchmark source · golang-migrate buffer implementation


r/sqlite • • 4d ago

SQLite foreign keys are off by default, per connection: four small experiments (tested on 3.53.1)

1 Upvotes

If you declare REFERENCES in your schema and assume the database enforces it, here’s something worth checking. I ran four small experiments on SQLite 3.53.1 from Python.

Schema:

CREATE TABLE parent (id INTEGER PRIMARY KEY);
CREATE TABLE child (
    id INTEGER PRIMARY KEY,
    parent_id INTEGER REFERENCES parent(id) ON DELETE CASCADE
);
INSERT INTO parent VALUES (1);

1. Default connection

PRAGMA foreign_keys;                       -- 0
INSERT INTO child (parent_id) VALUES (999);  -- accepted, no error

The orphan row was accepted. With foreign_keys at 0, the REFERENCES clause isn’t enforced.

2. After turning it on

PRAGMA foreign_keys = ON;
PRAGMA foreign_keys;                       -- 1
INSERT INTO child (parent_id) VALUES (999);
-- FOREIGN KEY constraint failed
INSERT INTO child (parent_id) VALUES (1);
DELETE FROM parent WHERE id = 1;           -- cascades; child is now empty

Enforcement works, including ON DELETE CASCADE (0 child rows left).

3. Inside a transaction, the pragma did nothing

BEGIN;
PRAGMA foreign_keys = ON;
PRAGMA foreign_keys;   -- 0 (still off)
COMMIT;
PRAGMA foreign_keys;   -- 0

In my test, turning it on inside an open transaction had no effect, and it stayed off after the commit. As I understand the docs, the setting can’t be changed while a transaction is open, so set it right after opening the connection, before any BEGIN. Check the official documentation for the exact wording.

4. It’s per connection, not per database file

connection a (set ON):  1
connection b (same file, new connection): 0

The setting isn’t stored in the database file, so each new connection starts with the default again. A second process or a different tool opening the same file may not enforce your foreign keys.

What I’d do about it (opinion):

  • Run PRAGMA foreign_keys = ON right after every connection is opened, ideally in the one place your code creates connections (a connection factory or pool hook).
  • Add a test that tries to insert an orphan row and expects it to fail, so a future change that bypasses the setup gets caught.
  • To audit existing data, PRAGMA foreign_key_check lists violations. I haven’t run it in these experiments, so check how it behaves on your database.
  • Some libraries and drivers enable it for you and others don’t, so check yours.

Limits: this is one SQLite version and one driver (Python’s sqlite3), and the behavior can be changed by compile-time options, which I haven’t tested. If you use an ORM, it may set the pragma for you.

Do you enable foreign keys in a connection hook, a test, or do you leave them off? Any surprises from tools opening the same file?


r/sqlite • • 4d ago

SQLite & CSV/JSON Suite

0 Upvotes

If you ever need to inspect a .sqlite or .db file without uploading it to a server or installing a desktop client, KitWharf's SQLite Viewer ( https://kitwharf.com/sqlite-viewer/ ) runs SQLite compiled to WebAssembly right in your browser tab. You can browse tables, run custom SQL queries, and export results to CSV/JSON—paired with our CSV to JSON Converter ( https://kitwharf.com/csv-to-json-converter/ ) for quick data transforms.


r/sqlite • • 4d ago

Learning SQL with Python?

Post image
1 Upvotes

This 👉interactive SQLite demonstration helps student understand relational databases.

The sqlite3 extension of 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 makes database content visible alongside Python's data structures. The demo shows how to:

  • Create tables with primary and foreign keys.
  • Model relationships between students, courses, and teachers.
  • Insert data and observe how the database changes.
  • Combine multiple tables using SQL JOIN operations.
  • Use parameterized queries.

The final query answers a seemingly simple question: Which teachers teach Alice, and for which courses? Answering this question involves joining five tables!

With 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡, students can step through the Python program and inspect the database content at every step, directly in their browser, without installing anything.

See 👉other 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 visualizations.


r/sqlite • • 4d ago

Qryndel: a query language for SQLite that refuses risky queries before they run (Python, MIT)

Post image
0 Upvotes

r/sqlite • • 5d ago

Built a local-first bookmark & PKM action engine backed by a single SQLite file (Go + embedded UI)

4 Upvotes

Sharing Sparkkeep (v0.1.0, AGPL-3.0) — a self-hosted bookmark and knowledge action engine where your entire library, triage state, playbooks, and digests live in a single portable SQLite database.

Repo: https://github.com/BurlacuAndrei/sparkkeep

Why SQLite was the centerpiece

Most self-hosted bookmark apps ask you to spin up Postgres, Redis, Meilisearch, and background worker containers just to save links. Keeping everything in a single Go binary + SQLite means:

  • Backups are literally copying one .db file.
  • Fast local search and filtering with zero external search daemon.
  • Runs comfortably on a tiny VPS, Raspberry Pi, or homelab container.

It also pairs with local Ollama (or any OpenAI-compatible endpoint) if you want automatic enrichment/digests, plus Discord/Slack/Telegram capture adapters. Happy to hear feedback on the schema or SQLite performance!


r/sqlite • • 5d ago

Debug RAG Retrieval Visually: SQLite + sqlite-vec 3D Explorer

Thumbnail github.com
1 Upvotes

r/sqlite • • 5d ago

SQLite & CSV/JSON Suite

Thumbnail reddit.com
1 Upvotes

r/sqlite • • 5d ago

Debug RAG Retrieval Visually: SQLite + sqlite-vec 3D Explorer

1 Upvotes

r/sqlite • • 6d ago

TalaDB — An open-source, local-first database

Thumbnail reddit.com
1 Upvotes

r/sqlite • • 6d ago

🚀 Built an Omarchy-focused fork of sqlit!

0 Upvotes

A keyboard-driven SQL client with automatic Omarchy theme syncing 🎨

Switch themes and sqlit follows instantly. No configuration needed.

https://github.com/JackyyyGames/sqlit-omarchy


r/sqlite • • 8d ago

LunoDB 2.3.2: one connection opens the whole server

Thumbnail reddit.com
0 Upvotes

Looking for feedback! I’m looking to make the best database client app for macOS, Windows and Linux 💪🏻


r/sqlite • • 9d ago

I build ZeBridge to sync Postgres to local SQLite over NATS JetStream and let apps edit data offline

Thumbnail github.com
2 Upvotes

I’m building ZeBridge for apps that read and edit a local SQLite database and sync through Postgres. I wanted to measure something a user actually experiences on first launch: how long until they can query all their data?

Seeding test: on one machine, Postgres, NATS, the bridge and 10 clients together, each with an empty SQLite database. Each loaded the same 50,000 rows, about 200 bytes per row. The median time per client was 3 seconds. Every replica matched the expected checksum and all ten clients can reuse it.

The compressed snapshot was ready before the timer started. The measurement includes fetching it and materializing the rows in SQLite; preparing the snapshot is a separate server-side cost.

Live updates: suppose the snapshot contains rows A and B. While a phone is loading it, someone updates A and deletes B in Postgres. The phone needs to know exactly where to start reading changes. ZeBridge records the stream position covered by the snapshot. Once the seed commits locally, the client replays the changes after that position from NATS JetStream.

There’s a test for that boundary: pause the client just after its seed commits, check that SQLite still has the old A and B, then let replay run. A must have its new value, B must be gone, and the replica must match Postgres.

For people who ship prepopulated SQLite databases: do you hand off to live updates this way, or distribute a ready-made database file? I’d be interested in what drove that choice, especially on phones.

ZeBrdige project

Benchmark setup and results

Snapshot handoff test


r/sqlite • • 11d ago

An SQLite cheat sheet that could be useful to beginners

Thumbnail tms-outsource.com
15 Upvotes

r/sqlite • • 10d ago

One SQLite file per generated app: counters, imports and what a restore breaks

0 Upvotes

My open-source builder gives every generated app its own SQLite file. Notes that may help others:

- Auto-numbers are assigned inside the insert transaction as the largest of the start value, the last number plus one, and the highest stored value plus one. That keeps numbering correct after imports.

- 200 parallel inserts across two handles produced no duplicates in tests.

- CSV import runs in batches of 500, one transaction per batch, so a failure stops cleanly at a known row.

- The unsolved case: restoring an older backup hands out numbers already issued after that backup. I documented it instead of pretending to fix it.

How do you handle counters across restores?

Repo (my project): https://github.com/ChristianMunoz31/local-app-studio


r/sqlite • • 11d ago

How does a SQLite server work?

6 Upvotes

Hey guys, I'm new to SQL and all of the tech. I'm planning on using SQLite for a school project, cos I heard it's relatively simple and easy-to-use. However, before I install and mess around with it, I have some questions.

So, this project will act as an application on someone else's computer, and that's the part that confuses me. Because if I install SQLite on my computer, create a database using it and integrate said database into a Java application, will the database I created remain exclusive to my computer, or can I transfer it to another user's computer? (if that makes sense). Like, if I export this Java application onto another computer, what will happen to the database? Do I manually need to copy and config it for every computer my application is running on, or no, not really?

Sorry if this is a stupid question, I'm new to all of this so I really would appreciate someone clarifying this for me.

Thanks in advance!


r/sqlite • • 10d ago

Ruddy is now running DuckDB 2.0!

0 Upvotes

Hey everyone,

I’m an independent developer who started building Ruddy in my free time: a fast, modern macOS IDE for data management, analysis, and data science powered 100% by DuckDB.

With this new release, the core engine has officially been upgraded to DuckDB 2.0!

Ruddy runs on a true Pay-What-You-Want (PWYW) model—support independent development with whatever you feel it’s worth, or start exploring for free.

Check it out: ruddy.pro

I’d love your thoughts, benchmark requests, or features you'd like to see next!

What’s inside Ruddy:

  • DuckDB 2.0 Core Engine: Blazing-fast columnar processing over local files, Parquet, Arrow, CSV, and Iceberg/Delta Lake tables without spinning up heavy infra.
  • Multi-Cloud Direct Querying: Federate and query across AWS S3, Cloudflare R2, Google Cloud Storage, Azure Blob, and MotherDuck seamlessly in a single SQL statement.
  • Reactive Notebooks & Marimo: Build reproducible, reactive Python data science notebooks that sync directly with your in-memory DuckDB tables.
  • First-Class Geospatial Analytics: Full DuckDB spatial extension support—render GeoParquet, Shapefiles, and spatial geometries interactively on high-performance maps.
  • Auto-Ontology & Modular Semantic Layer: Automatically infers FACT/DIMENSION roles, deduces canonical SQL metrics, verifies joins via physical data overlap, and generates Open Semantic Interchange (OSI v1.0 / Apache Ossie) YAML specifications per dataset domain.
  • Context-Aware AI Assistant (Ruddynie): Text-to-SQL agent grounded in your workspace ontology and self-improving query memory—zero phantom table or join hallucinations.
  • Model Context Protocol (MCP) Integration: Expose your DuckDB catalogs, query tools, and semantic context to any external MCP-compatible AI agent or client.
  • Built-in Git Version Control: Track schema migrations, SQL queries, notebooks, and semantic models with standard Git repositories right from the workbench.
  • Force-Directed Semantic Graphs & Visual SQL Builder: Explore domain schemas visually or drill down with interactive force-directed relationship maps.