SDI.
All Databases
RelationalOps: medium

PostgreSQL

PostgreSQL is an advanced open-source relational database known for its standards compliance, extensibility, and rich feature set including JSONB, full-text search, and PostGIS spatial queries. It uses MVCC (Multi-Version Concurrency Control) to handle concurrent transactions without read locks, making it well-suited for mixed read/write workloads. PostgreSQL supports advanced SQL features such as window functions, CTEs, lateral joins, and partial indexes that are often missing from competing systems.

Strengths

ACID-compliant with serializable isolation via SSI (Serializable Snapshot Isolation)Extensible type system supporting custom types, operators, and index methods (GIN, GiST, BRIN)JSONB column type provides document-store capabilities with indexable nested queriesMature logical and streaming replication with synchronous commit optionsAdvanced query planner with support for parallel query execution across multiple coresRich ecosystem of extensions (PostGIS, pg_trgm, TimescaleDB, pgvector)

Weaknesses

Write-heavy workloads suffer from MVCC bloat requiring regular VACUUM maintenanceHorizontal sharding is not built-in; requires external solutions like Citus or application-level partitioningConnection-per-process model limits concurrency without a pooler like PgBouncerReplication lag on read replicas can serve stale data under high write throughputNo built-in multi-master replication; solutions like BDR add operational complexity

Ideal Workloads

  • -OLTP applications with complex joins, constraints, and referential integrity requirements
  • -Applications needing both relational and semi-structured (JSONB) data in one system
  • -Geospatial workloads using PostGIS for location-based queries
  • -Analytical queries on moderate data volumes using parallel sequential scans and partitioning

Scaling Model

Scales vertically by adding CPU, memory, and fast storage (NVMe SSDs). Horizontal read scaling via streaming replicas. Write scaling requires external sharding (Citus, Vitess-like approaches) or declarative table partitioning for large tables. Connection pooling (PgBouncer) is essential at scale to overcome the process-per-connection model.

Consistency Model

Strong consistency by default with read-committed isolation. Supports serializable isolation via SSI. Synchronous replication can be configured per-transaction to guarantee zero data loss on failover, at the cost of write latency. Asynchronous replicas provide eventual consistency with configurable replication lag monitoring.

When to Use

  • You need ACID transactions with complex schemas and referential integrity
  • Your queries involve multi-table joins, aggregations, or window functions
  • You want a single database that handles relational, JSON, full-text search, and geospatial data
  • You need strong consistency guarantees and are willing to scale vertically first
  • Your team values SQL standards compliance and a mature, well-documented ecosystem

When Not to Use

  • You need automatic horizontal write scaling across dozens of nodes (consider CockroachDB or Cassandra)
  • Your workload is predominantly simple key-value lookups at sub-millisecond latency (consider Redis or DynamoDB)
  • You are ingesting billions of rows per day for analytics (consider ClickHouse or BigQuery)
  • You need multi-region active-active writes with automatic conflict resolution

Source: editorial — Based on PostgreSQL 16 documentation and production operational experience

Command Palette

Search for a command to run...