Best Self-Hosted Databases

This is the most consequential choice on the site and the one people agonise over the least, because most self-hosters inherit whichever database their application requires.

Updated 2026-10-03 · 7 options compared

The short answer

PostgreSQL unless you have a specific reason otherwise. It runs everything, has the strongest ecosystem, and every hosting question you will ever ask already has an answer for it. Reach for the others when your data has a shape PostgreSQL handles badly.

This is the most consequential choice on the site and the one people agonise over the least, because most self-hosters inherit whichever database their application requires. That is fine. What follows is for the cases where you are choosing — a new project, or a migration — and it is organised around data shape rather than benchmarks, because the honest difference in real self-hosted workloads is usually operational, not raw performance.

7 options at a glance

Comparison of the 7 self-hosted options ranked on this page
# Tool License Setup Best for
1 PostgreSQL PostgreSQL Intermediate Nearly everything relational, and the safe default for a new project.
2 MariaDB GPL-2.0 Intermediate PHP applications and workloads built around the MySQL dialect.
3 Valkey BSD-3-Clause Intermediate Caching, queues and session state that can be rebuilt.
4 MongoDB SSPL Intermediate Flexible or rapidly evolving document schemas.
5 ClickHouse Apache-2.0 Advanced Analytics and aggregation over very large datasets.
6 Apache CouchDB Apache-2.0 Intermediate Offline-first applications that must sync on reconnect.
7 Garage AGPL-3.0 Advanced Lightweight geo-distributed S3 storage across a few nodes.

Which one should you pick?

Start with the shape of the data. Relational with integrity constraints: PostgreSQL. Relational and inherited from a decade-old PHP application: MariaDB. Key-value with high read volume and the ability to lose everything on restart: Valkey. Documents with flexible schemas: MongoDB, or FerretDB if you want that API over PostgreSQL storage. Analytical queries over billions of rows: ClickHouse. Flat objects at scale: MinIO, Garage or SeaweedFS. The most common mistake is not picking the wrong engine — it is running a database with no tested backup, which is a data-loss incident on a timer.

What actually decides it

All 7 options, in order

1

PostgreSQL

Best for: Nearly everything relational, and the safe default for a new project.

The default answer because it is genuinely that good: rigorous about correctness, feature-rich far beyond what most users touch — JSON, full-text search, geospatial, extensions — and backed by the deepest pool of documentation and community answers of any database. Almost every application you will self-host supports it, and starting here means never migrating for a bad reason.

Databases & Storage PostgreSQL Intermediate ★ 22,262

Replaces: MySQL, MariaDB, Amazon RDS

Full review of PostgreSQL →

2

MariaDB

Best for: PHP applications and workloads built around the MySQL dialect.

The community continuation of MySQL, and the pragmatic answer for the enormous installed base of PHP applications built against that dialect. It is fast, well understood, and every hosting provider supports it. Choose it when something requires it rather than on its own merits — but when that requirement exists, it is the right choice and not a compromise.

Databases & Storage GPL-2.0 Intermediate ★ 8,308

Replaces: MySQL, PostgreSQL, Amazon Aurora

Full review of MariaDB →

3

Valkey

Best for: Caching, queues and session state that can be rebuilt.

Under its current name Valkey, and the answer for caches, queues, session stores and rate limiters — the fast, ephemeral layer almost every application wants. The critical thing to understand is that it is designed around data that may be lost: treat it as a cache with a rebuild path, not as your source of truth, and the failure modes stop being alarming.

Databases & Storage BSD-3-Clause Intermediate ★ 27,352

Replaces: Redis Enterprise, Amazon ElastiCache, Memcached

Full review of Valkey →

4

MongoDB

Best for: Flexible or rapidly evolving document schemas.

Document storage with a flexible schema, which is genuinely the right model when your data is a varied collection of records that would require constant migrations in a relational schema. The licence is a real consideration for commercial use, and FerretDB on this list offers the API without it.

Databases & Storage SSPL Intermediate ★ 28,617

Replaces: Amazon DocumentDB, Firebase Firestore, CouchDB

Full review of MongoDB →

5

ClickHouse

Best for: Analytics and aggregation over very large datasets.

A columnar engine built for analytical queries — aggregating and slicing enormous datasets — where it is orders of magnitude faster than a row-store. It is not an OLTP database and should not be used as one. Deploy it when you have real analytical volume, because below that threshold the operational cost is not repaid.

Databases & Storage Apache-2.0 Advanced ★ 50,191

Replaces: Google BigQuery, Amazon Redshift, Snowflake

Full review of ClickHouse →

6

Apache CouchDB

Best for: Offline-first applications that must sync on reconnect.

The database whose headline feature is synchronisation: offline-first clients that reconcile with a server, with a documented conflict model. That makes it the right foundation for an application designed to work offline, a niche where the relational options are considerably more work.

Databases & Storage Apache-2.0 Intermediate ★ 6,967

Replaces: Firebase Firestore, MongoDB, PouchDB Cloud

Full review of Apache CouchDB →

7

Garage

Best for: Lightweight geo-distributed S3 storage across a few nodes.

S3-compatible object storage that is dramatically lighter to operate than the alternatives, and designed to spread across machines that need not be in the same building. For a home lab with a couple of nodes holding backups and media, it is the right trade: a little less maturity for a lot less machinery.

Databases & Storage AGPL-3.0 Advanced ★ 4,625

Replaces: AWS S3, MinIO, Ceph

Full review of Garage →

How these compare to what you are using now

Other rankings