Postgres vs MySQL vs MariaDB: SaaS 2026 Pilih Mana
Tiga RDBMS untuk SaaS Indonesia 2026. Saya pakai Postgres 36 bulan, MySQL 24 bulan, MariaDB 18 bulan production. Verdict tergantung shape data + hosting + ekosistem.
TL;DR
- Postgres 17: Default safe untuk SaaS modern. JSONB + extension + RLS powerful. Conditional Recommend.
- MySQL 8.4: Matang, read-heavy performance, ekosistem terbesar. Conditional Recommend untuk legacy.
- MariaDB 11.6: Drop-in MySQL, license open, write-heavy lebih cepat. Conditional Recommend untuk self-host.
- Verdict: Postgres untuk new SaaS. MySQL/MariaDB untuk legacy atau niche.
Konteks
Saya pakai ketiga RDBMS di 14 project SMB Indonesia 2022-2026:
- PostgreSQL (9 project): SaaS dental, ecommerce klinik, admin HR, AI legal, content subscription, dan 4 lainnya — semua via Supabase / Neon / self-host VPS
- MySQL (3 project): klien legacy WordPress + WooCommerce, klien Laravel default, internal tool warung migrate dari MariaDB
- MariaDB (2 project): VPS self-host klien dengan write-heavy (logging + analytics)
Total 36 bulan compare. Latest stable: Postgres 17, MySQL 8.4, MariaDB 11.6.
Pricing (Juni 2026)
Managed hosting cost
| Service | Tier | Monthly |
|---|---|---|
| Supabase Postgres Free | 500MB | Rp 0 |
| Supabase Postgres Pro | 8GB + 250GB egress | Rp 400rb ($25) |
| Neon Postgres Free | 0.5GB + autoscale | Rp 0 |
| Neon Pro | 10GB | Rp 320rb ($20) |
| PlanetScale MySQL Hobby | 5GB | Rp 624rb ($39) |
| PlanetScale Scaler | 10GB + branching | Rp 1.5 juta ($95) |
| Aiven MySQL | 1GB | Rp 320rb ($20) |
| Aiven MariaDB | 1GB | Rp 320rb ($20) |
Self-host VPS (Niagahoster / Biznet)
- VPS 2GB RAM, 2 vCPU: Rp 120rb/bulan. Cukup untuk DB single-tenant SaaS 1-5K user.
- VPS 4GB RAM, 4 vCPU: Rp 250rb/bulan. Cukup untuk 5-20K user.
Postgres + MySQL + MariaDB sama-sama free di self-host.
Performance benchmark
Test workload: SaaS dental 1500 user, mix read (80%) + write (20%), schema 25 table dengan JSONB heavy.
Read QPS (single connection)
| DB | Simple SELECT | JOIN 3-table | JSONB query | Aggregation |
|---|---|---|---|---|
| Postgres 17 | 8,500 | 4,200 | 3,800 | 2,500 |
| MySQL 8.4 | 9,200 | 4,800 | 2,100 (JSON path) | 3,100 |
| MariaDB 11.6 | 9,800 | 5,100 | 2,300 (JSON path) | 3,400 |
MariaDB/MySQL win simple read by 10-15%. Postgres win JSONB by 50-80%.
Write QPS (INSERT/UPDATE)
| DB | Insert | Update | Concurrent write (10 conn) |
|---|---|---|---|
| Postgres 17 | 12,000/s | 9,500/s | 18,000/s |
| MySQL 8.4 | 14,000/s | 11,000/s | 22,000/s |
| MariaDB 11.6 | 16,500/s | 13,000/s | 26,000/s |
MariaDB win write by 15-20%. MySQL second. Postgres slightly behind tapi acceptable.
Latency Indonesia (Jakarta VPS to DB)
| Hosting | TTFB query |
|---|---|
| Supabase (Singapore) | 25-45ms |
| Neon (Frankfurt, closest free tier) | 180-280ms |
| Neon (Singapore Pro) | 30-50ms |
| PlanetScale (Singapore) | 28-48ms |
| Self-host VPS Jakarta (Biznet) | 3-8ms |
| Self-host VPS Singapore (Niagahoster) | 18-35ms |
Self-host Jakarta paling cepat untuk customer Indonesia. Managed Singapore acceptable.
Feature comparison
| Feature | Postgres 17 | MySQL 8.4 | MariaDB 11.6 |
|---|---|---|---|
| ACID | Yes | Yes | Yes |
| MVCC | Yes (native) | Yes (InnoDB) | Yes (InnoDB) |
| JSON support | JSONB (powerful) | JSON path | JSON path (mirip MySQL) |
| Window functions | Yes (advanced) | Yes (8.0+) | Yes |
| CTE | Yes (recursive) | Yes | Yes |
| Full-text search | Yes (built-in + extension) | Yes | Yes |
| Vector search | Yes (pgvector extension) | Limited (extension) | Limited |
| RLS (Row Level Security) | Yes (powerful) | No | No (Maxscale workaround) |
| Partitioning | Yes (advanced) | Yes | Yes |
| Replication | Streaming + logical | Native (async/semi-sync) | Native + Galera cluster |
| Storage engine | Heap + extension | InnoDB default | InnoDB + Aria + ColumnStore |
| Extension ecosystem | Excellent (pgvector, PostGIS, TimescaleDB) | Limited | Moderate (Galera, ColumnStore) |
| License | PostgreSQL (open) | GPL + commercial | GPL (full open) |
Trade-off
Postgres
Pro: JSONB powerful untuk schema flexible. pgvector untuk AI/RAG. PostGIS untuk geospatial. RLS untuk multi-tenant SaaS. Extension ecosystem terbesar. SQL standard adherence terkuat. Drizzle/Prisma support paling matang.
Con: Write performance sedikit di bawah MySQL/MariaDB (acceptable untuk most SaaS). Memory consumption lebih tinggi (300-500MB minimum). Replication setup lebih kompleks dari MySQL.
MySQL
Pro: Read performance excellent. Ekosistem tooling terbesar (MySQL Workbench, cPanel, phpMyAdmin). Documentation paling matang untuk Indonesia (banyak resource). Default Laravel, WordPress, WooCommerce. PlanetScale serverless branching unique.
Con: Oracle ownership concern (licensing future). JSON support lebih lemah dari Postgres. No RLS native. Extension ekosistem terbatas. JSONB equivalent (JSON path) slower.
MariaDB
Pro: 100% open-source (no Oracle concern). Drop-in MySQL replacement. Write performance terbaik. Galera cluster untuk multi-master replication mature. ColumnStore untuk analytics built-in. Lebih agresif feature development.
Con: Adopsi Indonesia lebih kecil — community resource less. Beberapa MySQL tool (MySQL Workbench latest) tidak full compat. Managed hosting Asia region terbatas.
Konteks Indonesia
SaaS dental Jakarta (Supabase Postgres): 1500 user, multi-tenant dengan RLS. JSONB untuk schema flexibility per klinik. pgvector untuk AI recommendation. Bill Rp 400rb/bulan. Migration dari MySQL Q4 2023 — ROI 2 bulan.
Klien legacy WordPress + WooCommerce (MySQL VPS): VPS Niagahoster Rp 80rb/bulan. MySQL 8.4 default cPanel. Tidak ada alasan migrate — works fine.
Admin warung scale (MariaDB self-host VPS): write-heavy (logging transaksi 50/menit peak). MariaDB 15% lebih cepat dari MySQL untuk workload ini. Galera cluster untuk HA. Cost VPS Rp 150rb/bulan.
AI legal assistant (Neon Postgres): pgvector untuk RAG document. Edge-compatible via Neon serverless driver. Bill Rp 320rb/bulan. Latency Jakarta 35ms.
Use case decision matrix
| Use case | Recommended |
|---|---|
| New SaaS multi-tenant | Postgres |
| AI SaaS dengan vector search | Postgres (pgvector) |
| WordPress / WooCommerce | MySQL (default) |
| Laravel default | MySQL atau MariaDB |
| Self-host VPS write-heavy | MariaDB |
| Self-host VPS Indonesia low budget | MariaDB atau MySQL (pakai cPanel) |
| Geospatial data | Postgres (PostGIS) |
| Time-series data | Postgres (TimescaleDB extension) |
| Branching workflow (dev/staging/prod) | PlanetScale MySQL atau Neon Postgres |
| Edge-first SaaS | Neon Postgres (serverless driver) atau Turso |
| Analytics + reporting heavy | MariaDB ColumnStore atau Postgres |
Migration paths
MySQL → Postgres
Effort: 1-3 minggu untuk schema 30-50 table.
Steps:
- Convert schema (pg_loader atau manual)
- Data type mapping (MySQL TINYINT → Postgres SMALLINT, etc)
- Migrate data (pgloader, mysqldump → import)
- Update application query (mostly compatible, beberapa SQL function beda)
- Test critical path
- Cutover dengan dual-write strategy untuk zero downtime
Tools: pgloader (most popular), AWS DMS, Bytebase, Foreign Data Wrapper Postgres.
MariaDB ↔ MySQL
Trivial. MariaDB drop-in MySQL replacement. Most case: change connection driver, done.
Postgres → MySQL/MariaDB
Effort: 2-4 minggu. Reverse direction. Loss feature: JSONB (downgrade ke JSON path), RLS (handle di application layer), extension (find alternative atau drop).
Self-host tips Indonesia
Postgres di VPS Jakarta
# Niagahoster / Biznet VPS
sudo apt install postgresql-17
sudo systemctl enable postgresql
# Tuning
# /etc/postgresql/17/main/postgresql.conf
shared_buffers = 512MB # 25% RAM
work_mem = 16MB
effective_cache_size = 1.5GB # 75% RAM
max_connections = 100
MariaDB di VPS
sudo apt install mariadb-server-11.6
# Tuning my.cnf
innodb_buffer_pool_size = 1G # 50% RAM
innodb_log_file_size = 256M
max_connections = 200
Backup strategy
Daily backup ke Cloudflare R2 (cheap egress):
#!/bin/bash
DATE=$(date +%Y%m%d)
pg_dump $DATABASE | gzip > /tmp/backup-$DATE.sql.gz
aws s3 cp /tmp/backup-$DATE.sql.gz s3://my-backups/postgres/ --endpoint-url https://[account-id].r2.cloudflarestorage.com
Cost backup R2: Rp 5-20rb/bulan untuk 50GB backup history.
Verdict
Conditional Recommend untuk ketiga:
Pakai Postgres jika:
- New SaaS modern (Indonesia 2026 default)
- AI feature (vector search via pgvector)
- Multi-tenant dengan RLS
- Geospatial atau time-series
- Stack edge (Neon, Supabase, Turso)
Pakai MySQL jika:
- Legacy project WordPress/WooCommerce
- Default Laravel + cPanel hosting
- Ekosistem tooling Indonesia familiar
- Read-heavy workload simple
Pakai MariaDB jika:
- Self-host VPS Indonesia
- Write-heavy workload (logging, analytics)
- License open-source strict
- Galera cluster untuk HA self-host
- ColumnStore untuk analytics built-in
Default untuk SMB Indonesia 2026: Postgres via Supabase atau Neon. Switch ke MariaDB self-host jika butuh kontrol penuh + budget tight.
Untuk DB hosting comparison: Turso vs Neon vs D1. Untuk migration MongoDB → Postgres: Migrasi MongoDB → Postgres JSONB.
Ditulis oleh Asti Larasati