← Semua picks

Stack Comparison Conditional

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.

19 Juni 2026 · 10 menit ·Use case: Database pilihan SaaS Indonesia 2026
PostgreSQL 17MySQL 8.4MariaDB 11.6

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

ServiceTierMonthly
Supabase Postgres Free500MBRp 0
Supabase Postgres Pro8GB + 250GB egressRp 400rb ($25)
Neon Postgres Free0.5GB + autoscaleRp 0
Neon Pro10GBRp 320rb ($20)
PlanetScale MySQL Hobby5GBRp 624rb ($39)
PlanetScale Scaler10GB + branchingRp 1.5 juta ($95)
Aiven MySQL1GBRp 320rb ($20)
Aiven MariaDB1GBRp 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)

DBSimple SELECTJOIN 3-tableJSONB queryAggregation
Postgres 178,5004,2003,8002,500
MySQL 8.49,2004,8002,100 (JSON path)3,100
MariaDB 11.69,8005,1002,300 (JSON path)3,400

MariaDB/MySQL win simple read by 10-15%. Postgres win JSONB by 50-80%.

Write QPS (INSERT/UPDATE)

DBInsertUpdateConcurrent write (10 conn)
Postgres 1712,000/s9,500/s18,000/s
MySQL 8.414,000/s11,000/s22,000/s
MariaDB 11.616,500/s13,000/s26,000/s

MariaDB win write by 15-20%. MySQL second. Postgres slightly behind tapi acceptable.

Latency Indonesia (Jakarta VPS to DB)

HostingTTFB 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

FeaturePostgres 17MySQL 8.4MariaDB 11.6
ACIDYesYesYes
MVCCYes (native)Yes (InnoDB)Yes (InnoDB)
JSON supportJSONB (powerful)JSON pathJSON path (mirip MySQL)
Window functionsYes (advanced)Yes (8.0+)Yes
CTEYes (recursive)YesYes
Full-text searchYes (built-in + extension)YesYes
Vector searchYes (pgvector extension)Limited (extension)Limited
RLS (Row Level Security)Yes (powerful)NoNo (Maxscale workaround)
PartitioningYes (advanced)YesYes
ReplicationStreaming + logicalNative (async/semi-sync)Native + Galera cluster
Storage engineHeap + extensionInnoDB defaultInnoDB + Aria + ColumnStore
Extension ecosystemExcellent (pgvector, PostGIS, TimescaleDB)LimitedModerate (Galera, ColumnStore)
LicensePostgreSQL (open)GPL + commercialGPL (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 caseRecommended
New SaaS multi-tenantPostgres
AI SaaS dengan vector searchPostgres (pgvector)
WordPress / WooCommerceMySQL (default)
Laravel defaultMySQL atau MariaDB
Self-host VPS write-heavyMariaDB
Self-host VPS Indonesia low budgetMariaDB atau MySQL (pakai cPanel)
Geospatial dataPostgres (PostGIS)
Time-series dataPostgres (TimescaleDB extension)
Branching workflow (dev/staging/prod)PlanetScale MySQL atau Neon Postgres
Edge-first SaaSNeon Postgres (serverless driver) atau Turso
Analytics + reporting heavyMariaDB ColumnStore atau Postgres

Migration paths

MySQL → Postgres

Effort: 1-3 minggu untuk schema 30-50 table.

Steps:

  1. Convert schema (pg_loader atau manual)
  2. Data type mapping (MySQL TINYINT → Postgres SMALLINT, etc)
  3. Migrate data (pgloader, mysqldump → import)
  4. Update application query (mostly compatible, beberapa SQL function beda)
  5. Test critical path
  6. 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

// Pick Stack Comparison lain


← Semua picks RSS feed