Angehefteter Tweet

Using Postgres as a Data Warehouse
- Start with Postgres 18+ — asynchronous I/O makes table scans 2-3x faster than Postgres 15
- One command runs everything: `docker-compose up`. If partitioning breaks on localhost, it'll break in prod — test the real structure first
- Async I/O in Postgres 18 changes everything — sequential scans that took 45 seconds now take 15
- No config changes needed — it just works faster out of the box
- Postgres isn't just storage — it's your transform layer, your cache, your query engine
- Materialized views = dashboards that don't run live queries when 500 people open Slack at 9 AM
- Partition by date or tenant — keeps queries under 3 seconds without bigger hardware
- VACUUM and ANALYZE aren't optional
- Use schemas like folders — `raw` for ingestion, `staging` for transforms, `analytics` for BI
- JSONB feels flexible until you try to aggregate Millions rows — use real columns for anything you'll query often
- Foreign keys and constraints catch bad data before your dashboard does
- DuckDB reads Postgres tables directly — `duckdb 'SELECT * FROM postgres_scan(...)'`
- Run heavy aggregations in DuckDB, write results back to Postgres — best of both worlds
- Postgres 18's async I/O + DuckDB's columnar engine = the fastest local analytics stack nobody talks about
- Indexes win 90% of performance battles — btree for filters, GIN for arrays, BRIN for time-series logs
- `EXPLAIN ANALYZE` until you understand how Postgres thinks — if it scans 5M rows, add an index
- Async I/O helps, but indexes help more — fix the query plan before throwing hardware at it
- Backup is boring by design: `pg_dump` to S3 every night
- Back up schemas separately from data — schema recovery is 10x faster than full restores
- Postgres 18's faster I/O means backups and restores complete in half the time
- The real test: can a new engineer clone your repo, run `docker-compose up`, and query prod-like data in 5 minutes?
- Postgres 18 is the warehouse you already have — just use it properly
English


