Database Selection
Choosing the right database for your Memori deployment.
Decision Matrix
| Use Case | Database | Why |
|---|---|---|
| Development / prototyping | SQLite | Zero setup, file-based |
| Production (any scale) | PostgreSQL | Best concurrency, pooling, reliability |
| Existing MySQL infra | MySQL | No new database to manage |
| Enterprise Oracle shop | Oracle | Leverage existing licenses |
| Document-oriented needs | MongoDB | Flexible schema, horizontal scaling |
| CI / testing | SQLite | Fast, disposable, no dependencies |
Feature Comparison
| Feature | SQLite | PostgreSQL | MySQL | Oracle | MongoDB |
|---|---|---|---|---|---|
| Concurrent Writes | Limited | Excellent | Good | Excellent | Good |
| Connection Pooling | N/A | SQLAlchemy | SQLAlchemy | SQLAlchemy | Built-in |
| Cloud Hosting | N/A | Many | Many | Oracle Cloud | Atlas |
| Setup | None | Low | Low | Medium-High | Low |
| Driver | None | psycopg2-binary | pymysql | oracledb | pymongo |
When to Use Each
SQLite — Development, prototyping, single-user apps. One writer at a time — not for multi-user web apps.
PostgreSQL — Recommended for production. Concurrent reads/writes, connection pooling, available on every cloud platform.
MySQL — Good if your stack already runs MySQL. No reason to add another DB.
Oracle — Only if you already have Oracle infrastructure and DBA support.
MongoDB — Only NoSQL option. Uses PyMongo instead of SQLAlchemy but integrates fully with Memori.
Migration: SQLite to PostgreSQL
Only the engine creation changes — all other Memori code stays the same:
engine = create_engine("sqlite:///memori.db")
After switching, run mem.config.storage.build() to create tables in the new database. Memori creates the same schema across all databases.
Setup guides: SQLite | PostgreSQL | MySQL | Oracle | MongoDB