Skip to main content

PostgreSQL

Versions

VersionStatusNotes
18AvailableLatest
17AvailableRecommended
16Available
15Available
14Available

Connecting

ParameterValue
Host{name}.db.foundrydb.com
Port5432
Default databasedefaultdb
TLSRequired — 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"}'
ModeUse case
transactionWeb apps, short queries (recommended)
sessionApps 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:

ExtensionVersionUse case
pgcryptoEncryption functions
uuid-osspUUID generation
pg_stat_statementsQuery performance tracking
postgis3.xGeospatial data
timescaledb2.xTime-series data
vector0.7+Vector embeddings (AI/ML)
pg_trgmTrigram-based similarity search
hstoreKey-value storage in a column
ltreeHierarchical tree structures
unaccentText 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:

ParameterDefaultDescription
shared_buffers128MBMain memory cache — set to 25% of RAM
work_mem4MBPer-sort/hash memory — tune for complex queries
max_connections100Max simultaneous connections
effective_cache_size4GBPlanner hint for available OS cache
wal_levelreplicaSet to logical for logical replication slots
max_wal_senders10Max 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:

MetricDescription
pg_stat_database_tup_fetchedRows fetched
pg_stat_database_xact_commitTransactions per second
pg_replication_slots_lag_bytesReplication slot lag
pg_stat_bgwriter_buffers_cleanBuffer cache hit rate
pg_locks_countActive 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"}'