Readyset Docs

Readyset Cache

Deploy Readyset, add shallow caches for specific queries, and benchmark upstream vs cache head-to-head.

RDST doesn't just diagnose slow queries — it deploys Readyset caches and lets you benchmark the result.

What is Readyset?

Readyset is a real-time SQL cache that sits between your application and your database. It speaks the wire protocol of Postgres and MySQL, so applications connect to it the same way they connect to the primary database. Queries that match a configured cache are served from Readyset at memory speed; everything else is forwarded to the upstream database.

For background, see Readyset docs.

Shallow caching vs deep caching

Shallow cacheDeep cache (QueryPilot only)
What's storedParameterized query results with a TTLIncrementally-maintained result set, always fresh
InvalidationTTL-basedStreaming dataflow from upstream
RDST managesYesNo (use QueryPilot instead)
Best forRead-heavy queries that tolerate small TTLsRead-heavy queries that require strong freshness

rdst cache commands manage shallow caches. If you need deep caching with strict freshness guarantees, use Readyset QueryPilot.

The RDST cache workflow

The typical flow is deploy first, then cache queries, then measure:

  1. Deploy Readyset. rdst cache deploy --target prod-orders --mode docker starts a Readyset process (locally, remote via SSH, or in Kubernetes) and registers a new target for it, named <original>-cache.
  2. Add caches for specific queries. Pass a hash from the query registry to rdst cache add — typically one you found with rdst top or rdst analyze.
  3. Measure the impact. rdst query cache-compare runs the same query against the upstream database and the cache head-to-head and reports the delta.

Two other commands offer to deploy a cache for you, so you often won't run rdst cache deploy directly:

  • rdst init and rdst configure add prompt you at the end of target setup.
  • rdst audit --duration prompts before benchmarking captured queries.

If you accept either prompt, you can skip step 1 here.

# 1. Deploy
rdst cache deploy --target prod-orders --mode docker

# 2. Find a query to cache and add it
rdst top --target prod-orders
rdst cache add a1b2c3d4e5f6 --target prod-orders-cache

# 3. Measure
rdst query cache-compare a1b2c3d4e5f6 --target prod-orders --count 500

Deployment modes

rdst cache deploy supports three modes, each appropriate for a different environment:

ModeUse when
dockerYou want the simplest path — a local or remote Readyset container
systemdYou have a dedicated host for Readyset (EC2, bare metal, etc.)
kubernetesYour infrastructure runs on K8s and you want Readyset there too

Combined with --host (for remote deployment via SSH) and --script-only (generate the deploy script without running it), this gives you four real flows:

# Local Docker
rdst cache deploy --target prod-orders --mode docker

# Remote host via SSH
rdst cache deploy --target prod-orders --mode docker \
    --host 10.0.1.50 --ssh-user ubuntu --ssh-key ~/.ssh/prod.pem

# Systemd service
rdst cache deploy --target prod-orders --mode systemd

# Kubernetes
rdst cache deploy --target prod-orders --mode kubernetes \
    --namespace readyset --kubeconfig ~/.kube/config

# Generate the script without executing
rdst cache deploy --target prod-orders --mode docker --script-only

See rdst cache deploy for the full reference.

Sections in this guide

See also

  • rdst audit — the audit report ranks Readyset cache candidates across your database
  • rdst analyze — per-query cache-fit evaluation
  • Readyset QueryPilot — fully-managed caching on top of Readyset, when you want auto-discovery and deep caching