Video in progress

How do you decide whether to adopt PostgreSQL extensions (PostGIS, pg_partman, TimescaleDB, pgvector) in an organization?

An extension is a dependency that becomes part of the database. I check whether it's available in the managed environment, whether it's supported through major upgrades, what its license is, who knows it, and whether there's a way out. I write the decision into an ADR and add the extension to an approved list.

📖 Answer

Installing an extension is one line: CREATE EXTENSION postgis;. Getting out of it can take months: data types, indexes and functions spread through the code. That's why I treat it as a platform decision, not like adding a library.

The questions I check:

  1. The environment. Is it available in the managed service we use, and in which version? The RDS/Cloud SQL lists are limited. Many TimescaleDB features aren't in plain Postgres in the cloud, because its license is different.
  2. Upgrades. For each major version, does the extension come out in a matching version too? During pg_upgrade the extension has to be installed for both versions. Several times it was exactly the extension that delayed an upgrade.
  3. Replication and backup. Does it work correctly with logical replication and pg_dump/restore? Is it installed on all the replicas?
  4. Ownership. Who on the team knows it deeply? Who do we turn to when something breaks?
  5. The alternative. Can the same thing be done with plain SQL or in the application? For example, a small job instead of pg_partman; a separate vector database instead of pgvector.

Then I split them into three groups:

  • Standard, safe: pg_stat_statements, pgcrypto, btree_gist, pg_trgm, citext: part of contrib, available everywhere.
  • With approval: PostGIS, pgvector, pg_partman: widespread and well supported.
  • Separate review: those with a special license or vendor.

This list lives in the platform docs, and the migration linter blocks any CREATE EXTENSION that isn't on the list.