Databases: choosing and running one
This page is for engineers who choose the database for a project or review that choice. The support statement, with versions, settings, backup and migration for each engine, is Database support; this page condenses it into the questions an architecture decision needs.
Contents
- The official order
- Compared for engineers
- A decision table
- What the choice changes in code
- Which database is a site using?
The official order
Supported databases (Exponential 6.0.x), in order of preference: 1. SQLite 3 (the default) · 2. PostgreSQL · 3. MongoDB · 4. MariaDB · 5. Oracle · 6. MySQL. Microsoft SQL Server is known to be possible with additional work.
All six have a driver in the kernel or a shipped extension, an entry in the setup wizard and a path in the command-line installers. The order is a recommendation for new sites, not a ranking of quality (Database support).
Compared for engineers
| SQLite 3 | PostgreSQL | MongoDB | MariaDB | Oracle | MySQL | |
|---|---|---|---|---|---|---|
DatabaseImplementation | sqlite3 | ezpostgresql | mongodb | ezmysqli | ezoracle | ezmysqli |
| Driver class | eZSQLite3DB | eZPostgreSQLDB | expMongoDB | eZMySQLiDB | eZOracleDB | eZMySQLiDB |
| Server process | none (one file) | yes | yes | yes | yes | yes |
| Several web servers on one database | no | yes | yes | yes | yes | yes |
| Transactions | yes, writers serialized | yes | no: each operation commits on its own | yes | yes | yes |
| Tested in the project's CI | driver unit tests | yes (PostgreSQL 15) | adapter unit tests | no | no | yes (MySQL 8.0) |
| SQL query cache | yes | yes | not used | yes | yes (ezoracle hooks) | yes |
Source: Database support, At a glance, Database and SQL standards and The SQL query cache.
A decision table
| Situation | A good fit | Why |
|---|---|---|
| One machine, no database administrator | SQLite 3 | no server to run; a full production database for a site served from one machine |
| Several web nodes, or a team that wants the best-tested server | PostgreSQL | tested in CI on every push; strict SQL; replication and point-in-time recovery |
| The organization standardized on MongoDB | MongoDB | supported through an adapter; read its limits first (MongoDB as the database) |
| A MySQL-compatible server is a given | MariaDB, then MySQL | same driver (mysqli); MySQL is tested in CI |
| The organization standardized on Oracle | Oracle 19c or later | through ezoracle, which composer.json requires |
Weigh the CI column: MariaDB and Oracle have no CI job in the kernel repository, so a regression specific to them is found later (Database and SQL standards, Known gaps).
What the choice changes in code
- Kernel and extension code must work on every engine: escape and cast, pass limits as parameters, avoid one engine's functions without a fallback (Writing portable SQL).
- Schema changes must ship for every driver (Schema changes and migrations).
- On MySQL and MariaDB, characters outside the Basic Multilingual Plane (emoji, for example) cannot pass through the
connection even with
utf8mb4tables (Internationalization standards). - The MongoDB adapter needs PHP 8.2 or later.
Which database is a site using?
./console exp:ini where site.ini/DatabaseSettings/DatabaseImplementationThe administration shows it under Setup > System information. Moving a site to another engine is described in Database support, Moving a site to another database and Changing the database engine.
Related pages
- Chapter 9 of the installation guide: Databases
- Persistence and the database layer
- Databases in the official order, for hosts
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.