Everything below is already installed and created in local_db on first boot
(see scripts/init/00-extensions.sql). List them anytime with:
make extensions # what's created in the DB
make available # everything the image *could* offer| Extension | Connects to | Notes |
|---|---|---|
postgres_fdw |
other PostgreSQL servers | built-in contrib |
mysql_fdw |
MySQL / MariaDB | compiled from source in the image |
tds_fdw |
SQL Server / Sybase | via FreeTDS |
file_fdw |
CSV / flat files | file must be readable in the container |
dblink |
other PostgreSQL (ad-hoc) | function-style, not table-style |
Copy-paste recipes live in scripts/fdw-examples/.
Quick taste:
CREATE SERVER remote_pg FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host 'remote-postgres.example.com', port '5432', dbname 'remote_db');
CREATE USER MAPPING FOR CURRENT_USER SERVER remote_pg
OPTIONS (user 'remote_user', password 'secret');
IMPORT FOREIGN SCHEMA public FROM SERVER remote_pg INTO public;
SELECT * FROM some_remote_table LIMIT 5;| Extension | What it gives you | Example |
|---|---|---|
vector (pgvector) |
embedding storage + ANN search | CREATE TABLE items (id int, embedding vector(1536)); then ORDER BY embedding <=> '[...]' LIMIT 5; |
pg_trgm |
trigram fuzzy text search | WHERE name % 'jhon' |
unaccent |
accent-insensitive search | WHERE unaccent(name) ILIKE unaccent('café') |
fuzzystrmatch |
soundex / levenshtein | levenshtein('foo','for') |
| Extension | Use | Example |
|---|---|---|
pg_cron |
run SQL on a cron schedule, inside the DB | SELECT cron.schedule('nightly', '0 2 * * *', 'VACUUM ANALYZE'); |
pg_partman |
automated time/serial partitioning | manage big tables without manual partition DDL |
pg_cronis bound tolocal_dbviacron.database_name. Jobs run as the database owner. List jobs:SELECT * FROM cron.job;
| Extension | Use |
|---|---|
pg_stat_statements |
find your slowest/most frequent queries: SELECT query, calls, mean_exec_time FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 10; |
hypopg |
test indexes hypothetically before building them |
pg_hint_plan |
force planner choices when needed |
pg_repack |
remove table/index bloat without long locks |
pgaudit |
structured audit logging for compliance |
uuid-ossp, pgcrypto (UUIDs, hashing, encryption), citext (case-insensitive
text), hstore, ltree (trees), cube + earthdistance (geo distance without
PostGIS), intarray, isn, tablefunc (crosstab/pivot), btree_gin,
btree_gist.
SELECT gen_random_uuid(); -- pgcrypto
SELECT uuid_generate_v4(); -- uuid-ossp
SELECT earth_distance(ll_to_earth(-6.2,106.8), ll_to_earth(-7.8,110.4)); -- ~km*1000- apt-packaged? Add
postgresql-17-<name>to theDockerfile, rebuild. - needs source build? Follow the
mysql_fdwpattern in theDockerfile. - create it in
scripts/init/00-extensions.sql(or runCREATE EXTENSIONmanually for an already-running DB). - If it needs preloading, add it to
shared_preload_librariesinconfig/postgresql.confandmake restart.
✅ Next: the reasoning behind the resource caps → 5. Resource Tuning »