Deploy Metabase Caching
Metabase with query caching for heavy dashboards
metabase/metabase
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host self hosted Metabase Caching (Open-Source BI) on Railway
Thirty people open the same dashboard at 8:47 AM, and BigQuery runs the identical forty-second query thirty times. Metabase's query cache stores the result once in Postgres and serves the rest from there.
About Hosting Metabase Caching open-source software on Railway (self hosted Metabase template)
This is stock Metabase OSS with the query cache pointed at real Postgres, not a fork. The metabase/metabase container listens on port 3000; a companion Postgres 17 service (ghcr.io/railwayapp-templates/postgres-ssl) holds app state and cached results.
One container plus one Postgres is deliberately small: no Redis, no queue. It's fine for most teams, but it's not HA. A restart causes a brief blip, and a Postgres failure affects both app and cache.
Why Deploy Metabase Caching, the Tableau alternative on Railway (Railway Free Trial)
Tableau's per-viewer licensing gets painful fast. Self-hosted Metabase is AGPL free; you pay for compute, not seats. Fifty viewers cost about what five do. The tradeoff is you own deployment, upgrades, and cache tuning.
Metabase OSS lacks per-database, per-dashboard, per-question, Duration, Schedule, and auto-refresh caching, those are Pro/Enterprise. You do get the default policy in Admin → Performance (Adaptive or Don't cache) and a Clear cache button on that page.
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Metabase Caching on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Railway vs Other Hosting Providers and VPS for Metabase Caching self hosting
| Provider | Model | Metabase Caching experience | Rough cost |
|---|---|---|---|
| Railway | Managed PaaS | Template pre-wires Metabase + Postgres, env vars, health check | ~$5–15/mo on Hobby |
| DigitalOcean | Droplet/App Platform | You install Docker, wire Postgres, manage SSL and upgrades | Varies; droplet + DB adds up |
| AWS | EC2/RDS | Maximum control, many moving parts, VPC, security groups, RDS | Widely variable, easy to overspend |
| Hetzner | Bare metal/cloud VPS | Cheap compute, but OS to TLS is all manual | Lowest raw cost, highest time |
Railway's edge isn't price; Hetzner wins that. It's that the template already sets Postgres, health check GET /api/health on port 3000, and stable encryption secret.
Common Use Cases for hosted Metabase Caching
The classic case: a slow warehouse query hit by dozens of simultaneous dashboard viewers. A 40-second BigQuery query with 30 concurrent users becomes one warehouse scan and 29 Postgres reads.
Executive dashboards are another. The CEO opens revenue every morning at 7:30, but ETL updates only nightly. An Adaptive policy with a high multiplier means the first load pays warehouse cost and the rest of the morning reads from Postgres.
Dependencies for Metabase Caching Docker hosted on Railway
Two hard dependencies: the Metabase container and a production Postgres. The stock H2 is wiped on redeploy and not for production. Set MB_DB_TYPE=postgres plus MB_DB_HOST, MB_DB_PORT, MB_DB_USER, MB_DB_PASS, MB_DB_DBNAME to the companion service.
Analytics warehouses are separate. Connect them after first boot under Admin → Databases. The Metabase app Postgres stores Metabase state plus cache, not warehouse data. Don't point MB_DB_HOST at your analytics warehouse, that breaks deployment.
Deployment Dependencies for Managed Metabase Caching Service (BI with query caching)
A few things must be right on Railway. First, pin the official image metabase/metabase to a version like v0.63.x (not latest) so migrations don't surprise you at 2 AM. Second, use the Postgres 17 companion service and export connection variables.
Health check: GET /api/health on port 3000. It returns 200 when web server and app DB are reachable; it doesn't test warehouses.
Implementation Details for Metabase Caching (Using Metabase official docker image)
First boot runs migrations against app Postgres, creating tables for users, dashboards, permissions, and cache. Then the setup wizard creates the admin user. Connect warehouses under Admin → Databases. Cache settings live in Admin → Performance.
How does Metabase Caching compare against other BI and dashboard caching platforms
Every BI tool caches something; differences are where the cache lives, control, and whether caching is a feature or side effect.
Metabase Caching vs Tableau (Tableau Alternative)
Tableau caches via data extracts, materialized files rather than query results. It's more managed but less transparent, and per-user licensing makes caching a financial necessity.
Metabase Caching vs Power BI (Power BI Alternative)
Power BI caching ties to dataset refreshes, scheduled imports, and DirectQuery with aggregations. Smooth for Azure shops but heavier. Metabase's query result cache is simpler to reason about and doesn't need Premium capacity for predictable behavior.
Metabase Caching vs Apache Superset (Apache Superset Alternative)
Superset typically caches via Flask-Caching to Redis or Memcached: a separate in-memory store, faster for small hot sets but adds a service. Metabase stores results in Postgres, surviving restarts and keeping the stack at two containers.
Metabase Caching vs Redash (Redash Alternative)
Redash has per-query caching and is lighter overall, but fewer dashboarding features and less semantic layer. Redash wins on minimalism; Metabase wins on breadth after the cache returns rows.
How to use Metabase Caching (the OSS BI with query caching)?
Start in Admin → Performance. Adaptive is a sensible default, it measures average query duration and applies a multiplier, so a 40-second join gets a longer cache than a 200 ms lookup. On Pro, a Schedule policy tied to your 3 AM ETL is simpler.
OSS lacks per-dashboard and per-question policies, so after a backfill you clear the cache from Admin → Performance → Database caching. Invalidation is time-based: entries expire when the policy window elapses.
The cache lives in companion Postgres. Watch its size; clearing from Admin → Performance frees space. Caching should mask warehouse problems, not replace fixes.
How to self host Metabase Caching on other VPS Services (Metabase Caching self hosting guide)
Same shape, more manual.
Clone the Repository
Pull the official image: docker pull metabase/metabase:v0.63.x. No repo to clone unless building from source (rare). Use a compose file with two services: metabase and postgres.
Install Dependencies
Docker and Postgres. On Ubuntu: docker.io and docker-compose-plugin. Postgres 15–17 all work.
Configure Environment Variables
Set MB_DB_TYPE=postgres, MB_DB_HOST, MB_DB_PORT, MB_DB_USER, MB_DB_PASS, MB_DB_DBNAME. Set MB_ENCRYPTION_SECRET_KEY once, store in environment file or secrets, not a shell export. Set MB_SITE_URL. Map port 3000, add health check to /api/health.
Start the Metabase Caching Application
docker compose up -d. Watch logs for migrations. At http://server:3000, create admin user, connect warehouse, set cache policy in Admin → Performance.
Official Pricing of Metabase Caching (Metabase Caching pricing)
Metabase OSS is free under AGPL, no per-user or cache fees; you pay infrastructure. Metabase Cloud Starter is $100/mo plus per-user; Pro much higher with SSO, RLS, and finer cache controls.
Metabase Caching cloud vs self hosted comparison (Pricing, features, costs, and more)
Cloud buys you managed upgrades; self-hosting buys you control.
Monthly cost of self hosting Metabase Caching on Railway
A small Metabase + Postgres stack on Railway typically lands $5–15/mo on Hobby, range, not guarantee. Compare Cloud Starter at $100/mo plus per-user; self-host wins for smaller teams. Hidden cost is your time: upgrades, backups, cache monitoring.
System Requirements for Hosting Metabase Caching on a VPS
Plan at least 1 GB RAM for Metabase (2 GB with many concurrent users or large results). Postgres needs 512 MB floor, 1–2 GB comfortable. CPU rarely bottlenecks; warehouse does heavy lifting. Disk is sneaky: cache grows in Postgres.
Frequently Asked Questions (FAQs)
The questions that come up first.
How do I clear the Metabase cache?
On OSS, go to Admin → Performance → Database caching, pick the database, and hit Clear cache at the bottom. Pro adds a Clear cache button on each question and dashboard.
Why is my cached result stale?
Caching is time-based, not change-based. If ETL finished at 2 AM and policy is 6h, 7:30 AM shows last night's result, fine. But a manual backfill at 10 AM isn't known; clear the cache or lower the multiplier. Refresh cache automatically is Pro/Enterprise.
Does the cache hit my warehouse at all?
No. A cache hit reads from companion Postgres; your warehouse sees zero traffic. That's the point for metered warehouses, no scanned bytes or credit-seconds.
What happens if I don't set up Postgres and leave the default H2?
App state and cache live in a container file. A redeploy wipes users, dashboards, and cache. It also performs badly as cache grows. Always use MB_DB_TYPE=postgres.
Can I cache per dashboard in the open-source version?
No. Per-dashboard, per-database, per-question policies, Duration, Schedule, and auto-refresh are Pro/Enterprise. OSS gives one default policy (Adaptive or Don't cache). Adaptive covers most cases.
When should I fix the warehouse instead of caching?
When the query is slow for structural reasons, missing index, full scan, join that should be summary table. Caching hides the symptom from dashboard users, but the slow query still runs every time the cache expires.
Template Content
metabase/metabase
metabase/metabase