Skip to content
rusthacks.dev
Topic

Databases

Talking to Postgres, MySQL and SQLite from Rust with SQLx and Diesel, and schemas that age well.

Flat illustration for the post “Handling Database Timeouts and Retries in Rust Services”, composed around database.
Databases

Handling Database Timeouts and Retries in Rust Services

Set acquire, connect and statement timeouts, tell transient errors from permanent ones, retry only what is safe with backoff and jitter, and keep a retry from doubling a write. SQLx and PostgreSQL examples.

4 min read
Flat illustration for the post “Zero Downtime Database Migrations With Rust Services”, composed around deploy.
Databases

Zero Downtime Database Migrations With Rust Services

Change a live schema without an outage: expand, migrate, contract. Add columns safely, backfill in batches, create indexes concurrently, and order deploys so old and new code both work against the database.

4 min read
Flat illustration for the post “Per Test Databases in Rust With SQLx Test Attribute”, composed around testing.
Databases

Per Test Databases in Rust With SQLx Test Attribute

The sqlx::test attribute creates a fresh database for each test, runs your migrations, hands you a pool and drops it afterwards. Learn fixtures, the DATABASE_URL requirement, parallelism and common errors.

3 min read
Flat illustration for the post “Testing Database Code in Rust With Test Containers”, composed around deploy.
Databases

Testing Database Code in Rust With Test Containers

Run tests against a real PostgreSQL in a disposable container with the testcontainers crate. Start one per test run, migrate, isolate tests with transactions or databases, and keep CI fast with reuse.

4 min read
Flat illustration for the post “Full Text Search in Rust With PostgreSQL or Tantivy”, composed around database.
Databases

Full Text Search in Rust With PostgreSQL or Tantivy

Choose between PostgreSQL full text search (tsvector, GIN, ts_rank) and an embedded Tantivy index. See working queries from SQLx and a Tantivy schema, and when each is the right size of tool.

4 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.