Deployment

Simple helm charts:

Extensions

PostgreSQL Extensions are a plug and play set of enhancements that add an extra feature-set to PostgreSQL. Some of these features are as simple as reading or writing to an external database while others could be a sophisticated solution to implement database replication, monitoring, etc.

Postgis

CREATE EXTENSION IF NOT EXISTS postgis CASCADE;

Timescale DB

TimescaleDB is an open-source time-series database optimized for fast ingest and complex queries.

Images:

  • standard: timescale/timescaledb:latest-pg12
  • with postgis: timescale/timescaledb-postgis:latest-pg12

Extend the database with TimescaleDB:

CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;

Postgres configuration

You might want to work on replication, performance, number of connections, etc. Configuration of Postgres is mostly done with the postgresql.conf file; authentication is done with pg_hba.conf, recovery.conf for replicas and initdb for some parameters. Tuning is definitely worth it for improving tps (transactions per second) and latency.

Param max_connections is a hard limit (default=100); raise the number connection will trash the cash, latency will really increase. The solution is the connection pooler PgBouncer; decrease the number of connections and wait here untill there is enough: scale 1 on 1.

More configuration in this talk by Alvaro Hernandez.