FRGet In Touch
← Tech stack

PostgreSQL

A powerful open-source relational database, reliable enough for banks and flexible enough to store JSON next to classic tables.

Type
Relational database (SQL)
Created by
The PostgreSQL Global Development Group, open source (PostgreSQL License)
Strengths
Transactions, constraints, JSON, full-text search
In my stack
The main database behind my backends

What it is

PostgreSQL stores data in tables linked by relations, and you query it with SQL. It has been developed in the open for more than 30 years and is known for doing the boring things right: every transaction is either fully saved or not at all, data survives crashes, and the rules you declare are enforced by the database itself.

It is also far more than plain tables. A jsonb column stores flexible documents that can be indexed and queried, full-text search is built in, and extensions add geographic data (PostGIS), vector search for AI (pgvector) and much more. Every major cloud offers it as a managed service.

Why I use it

The data stays correct. Foreign keys, unique constraints and checks mean an inspection can’t point to a site that doesn’t exist, whatever bug the application has. For audit and compliance data, that guarantee is the point.

Relational and flexible at once. Core data lives in strict tables, while forms that vary from one checklist to another fit in a jsonb column, without a second database.

Mature and predictable. Backups, replication, point-in-time recovery and monitoring are well understood, and any experienced developer or DBA can pick it up.

No lock-in. It is truly open source and runs the same on a laptop, in Docker, on Azure or at OVH.

Where I use it

PostgreSQL is the database of the HR management system. The Go backend stores employee records, leave requests, the attendance data synced from the mobile app, and the audit trail, with Redis alongside. Because each record keeps the ID it was given on the phone, syncing is safe to repeat: receiving the same clock-in twice changes nothing.

Best use cases

  • Business applications with users, permissions, workflows and data that must stay consistent.
  • Audit, quality and compliance data, where integrity and history matter more than raw speed.
  • Mixed data: strict tables for the core, jsonb for forms and settings that vary.
  • Reporting: complex SQL queries, views and aggregates that feed dashboards or Power BI.

When I’d use something else

Inside a mobile app that has to work offline, the database must live on the phone, which is what SQLite is for. For a cache, sessions or counters that change thousands of times a second, Redis is the right tool next to it. And for analytics over billions of rows, a columnar warehouse like ClickHouse or BigQuery answers faster.

A small example

A table for inspections that syncs safely from offline devices, and a query inside the JSON data.

CREATE TABLE inspections (
  id         uuid PRIMARY KEY,                    -- generated on the phone
  site_id    uuid NOT NULL REFERENCES sites (id),
  status     text NOT NULL CHECK (status IN ('open', 'closed')),
  data       jsonb NOT NULL,                      -- the checklist answers
  created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX ON inspections USING gin (data);

-- Sync is safe to repeat: the same inspection twice changes nothing
INSERT INTO inspections (id, site_id, status, data)
VALUES ($1, $2, $3, $4)
ON CONFLICT (id) DO NOTHING;

-- Open inspections that flagged work at height
SELECT id FROM inspections
WHERE status = 'open'
  AND data @> '{"hazards": ["work at height"]}';

Often used with

Need a database designed to keep your data correct for years?

Get in touch and tell me about your project.