Migration to PostgreSQL
Kelvin de Reus•December 7, 2025
Current Database Stack
We were using:
- MariaDB: Serves as our primary relational data store. Handles structured data such as user accounts, settings, and core app entities.
- Redis: Caching
- ClickHouse: Handles analytics and large-scale reporting, optimized for high-speed aggregations on massive datasets. Which works fine, tho PostgreSQL has some advantages for our application
Why We Switched to PostgreSQL
For our evolving application requirements, PostgreSQL provides several advantages that make it a better fit:
- High-Concurrency Workload Handling PostgreSQL’s MVCC (Multi-Version Concurrency Control) architecture allows many read and write operations to occur simultaneously without blocking each other. This is particularly beneficial in our scenario where the Next.js dashboard and Discord bot are accessing the database concurrently.
- Cloud-Friendly Deployments PostgreSQL enjoys excellent support across major cloud providers (AWS RDS, GCP Cloud SQL, Azure Database), simplifying replication, failover, and multi-region deployment. This aligns well with our goals for scalability and high availability.
- Advanced JSON Support With JSONB, PostgreSQL allows us to store and query semi-structured data efficiently. This is useful for storing flexible data structures, such as bot settings, user preferences, or event logs, without sacrificing query performance.
- Seamless Prisma Integration PostgreSQL has first-class support in Prisma, our chosen ORM. This improves developer productivity, type safety, and query optimization, and makes database migrations and schema management more straightforward.
- Data Integrity and Reliability PostgreSQL offers strong ACID compliance and robust transaction management, ensuring our data remains consistent even under high load or in multi-service environments.
Summary
While our previous stack (MariaDB + Redis + ClickHouse) served us well, PostgreSQL consolidates many of these capabilities into a single, highly reliable system. It allows us to simplify the architecture, improve concurrency handling, leverage modern cloud features, and take full advantage of Prisma’s tooling, making it a better choice for our Next.JS dashboard and Discord bot ecosystem.