PostgreSQL
Versions
| Version | Status | Notes |
|---|---|---|
| 18 | Available | Latest |
| 17 | Available | Recommended |
| 16 | Available | |
| 15 | Available | |
| 14 | Available |
Connecting
| Parameter | Value |
|---|---|
| Host | {name}.db.foundrydb.com |
| Port | 5432 |
| Default database | defaultdb |
| TLS | Required — sslmode=verify-full |
PGPASSWORD=pass psql \
"host=HOST user=USER dbname=defaultdb sslmode=verify-full"
Full connection string examples for all languages: Connection Strings →
Connection Pooling (PgBouncer)
PgBouncer is available on port 5433. Enable it:
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/pooler \
-H "Content-Type: application/json" \
-d '{"pool_size": 25, "pool_mode": "transaction"}'
| Mode | Use case |
|---|---|
transaction | Web apps, short queries (recommended) |
session | Apps that use session-level features (advisory locks, SET, temp tables) |
Disable it:
curl -u admin:password -X DELETE \
https://api.foundrydb.com/managed-services/{id}/pooler
Read Replicas
Add a replica for read scaling or standby failover:
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/nodes \
-H "Content-Type: application/json" \
-d '{"role": "replica"}'
Each replica gets its own hostname. List nodes to get the replica hostname:
curl -u admin:password \
https://api.foundrydb.com/managed-services/{id}/nodes
Remove a replica:
curl -u admin:password -X DELETE \
https://api.foundrydb.com/managed-services/{id}/nodes/{node_id}
Failover
Promote a replica to primary (manual failover):
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/nodes/{node_id}/failover
Automatic failover triggers when the primary becomes unreachable for more than 30 seconds (requires at least one replica).
Point-in-Time Recovery
WAL archiving runs continuously. The retention window is 7 days by default.
Restore to a specific timestamp:
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/backups/restore \
-H "Content-Type: application/json" \
-d '{
"restore_point": "2026-03-15T14:30:00Z",
"target_service_name": "my-pg-restored"
}'
This creates a new service — it does not overwrite the existing one.
Extensions
Pre-installed extensions:
| Extension | Version | Use case |
|---|---|---|
pgcrypto | — | Encryption functions |
uuid-ossp | — | UUID generation |
pg_stat_statements | — | Query performance tracking |
postgis | 3.x | Geospatial data |
timescaledb | 2.x | Time-series data |
vector | 0.7+ | Vector embeddings (AI/ML) |
pg_trgm | — | Trigram-based similarity search |
hstore | — | Key-value storage in a column |
ltree | — | Hierarchical tree structures |
unaccent | — | Text search without accents |
Enable an extension:
CREATE EXTENSION IF NOT EXISTS vector;
Configuration
Tune PostgreSQL server parameters:
curl -u admin:password -X PATCH \
https://api.foundrydb.com/managed-services/{id}/configuration \
-H "Content-Type: application/json" \
-d '{
"parameters": {
"shared_buffers": "2GB",
"max_connections": "200",
"work_mem": "64MB",
"wal_level": "logical"
}
}'
Common tuning parameters:
| Parameter | Default | Description |
|---|---|---|
shared_buffers | 128MB | Main memory cache — set to 25% of RAM |
work_mem | 4MB | Per-sort/hash memory — tune for complex queries |
max_connections | 100 | Max simultaneous connections |
effective_cache_size | 4GB | Planner hint for available OS cache |
wal_level | replica | Set to logical for logical replication slots |
max_wal_senders | 10 | Max streaming replication connections |
Logical Replication
Enable logical replication slots for CDC (Change Data Capture) with tools like Debezium:
# Requires wal_level=logical
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/logical-replication/slots \
-H "Content-Type: application/json" \
-d '{"slot_name": "debezium_slot", "plugin": "pgoutput"}'
Metrics
Key metrics available in the dashboard and API:
| Metric | Description |
|---|---|
pg_stat_database_tup_fetched | Rows fetched |
pg_stat_database_xact_commit | Transactions per second |
pg_replication_slots_lag_bytes | Replication slot lag |
pg_stat_bgwriter_buffers_clean | Buffer cache hit rate |
pg_locks_count | Active locks |
curl -u admin:password \
"https://api.foundrydb.com/managed-services/{id}/metrics?metric=connections&period=1h"
Backups
Automated backups run daily. WAL archiving provides continuous PITR on top.
# List backups
curl -u admin:password \
https://api.foundrydb.com/managed-services/{id}/backups
# Trigger a manual backup
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/backups \
-H "Content-Type: application/json" \
-d '{"backup_type": "manual"}'