Nov 20, 20265 min read

RDS Postgres Parameter Groups: What to Change and How

How RDS parameter groups work, why the default group cannot be edited, static vs dynamic parameters, the Postgres settings worth changing first, and which settings belong in your migrations instead.

Illustration for RDS Postgres Parameter Groups: What to Change and How

An RDS parameter group is the postgresql.conf of a managed database, a named set of server settings that AWS applies to every attached instance. It stays invisible until you want slow query logging or a bigger work_mem and find the default group read-only and half the settings waiting on a reboot.

This guide covers how the groups behave, which values are worth changing, and which ones belong in application code instead.

How parameter groups work

Every RDS for PostgreSQL instance is attached to exactly one DB parameter group, and every group belongs to a family that matches the major version, such as postgres17. The RDS parameter group docs describe two kinds:

GroupEditableTypical use
Default (default.postgres17)NoWhat a new instance gets if you pick nothing
CustomYesAnything you want to tune

The default group is read-only, so the first change always starts with creating a custom group from the same family and attaching it:

aws rds create-db-parameter-group \ --db-parameter-group-name app-pg17 \ --db-parameter-group-family postgres17 \ --description "App settings for Postgres 17" aws rds modify-db-instance \ --db-instance-identifier app-db \ --db-parameter-group-name app-pg17 \ --apply-immediately

Attaching a new group leaves the instance in pending-reboot until it restarts, so plan the first switch for a maintenance window.

Static and dynamic parameters

Each parameter has an apply type, where dynamic parameters take effect within seconds of saving, while static parameters wait for the next reboot, and RDS lists the instance as pending-reboot in the meantime:

aws rds modify-db-parameter-group \ --db-parameter-group-name app-pg17 \ --parameters "ParameterName=log_min_duration_statement,ParameterValue=500,ApplyMethod=immediate" \ "ParameterName=shared_preload_libraries,ParameterValue='pg_stat_statements,auto_explain',ApplyMethod=pending-reboot"

Several values are formulas rather than numbers, for example max_connections defaults to LEAST({DBInstanceClassMemory/9531392},5000), so the same group gives a different connection limit on each instance class. Changing the instance class therefore changes these settings too, which is worth knowing before a resize.

Settings worth changing first

The PostgreSQL parameters appendix lists everything RDS exposes, and in practice a short list covers most backend workloads:

ParameterCommon changeWhy
log_min_duration_statement250 to 1000 ms (off by default)Logs slow statements to CloudWatch
auto_explain.log_min_duration1000 ms, with auto_explain preloadedLogs the plan of slow queries
idle_in_transaction_session_timeout60000 msEnds sessions that hold locks while idle
work_mem16 to 64 MB, up from 4 MBFewer sorts and hashes spilling to disk
log_lock_waits1Logs waits longer than deadlock_timeout
rds.force_sslKeep at 1, the default on 15 and laterRejects unencrypted connections

Treat work_mem with care, since the Postgres resource docs explain that it applies per sort or hash operation, so a complex query across many connections can use several multiples of it at once. Raise it moderately in the group and set larger values per session for the reporting queries that need them.

What should not live in the parameter group

A parameter group setting applies to every connection on the instance, including migrations, pg_dump and anyone debugging in psql. Limits that belong to one application or one query work better closer to it:

  • Per database or per role: ALTER DATABASE app SET statement_timeout = '5s' or ALTER ROLE reporting SET work_mem = '128MB' apply to new sessions and live in version control as migrations.
  • Per transaction: SET LOCAL statement_timeout = '30s' inside a transaction covers one known-slow query and resets at commit.

This split keeps the group small and server-level, while the limits that depend on what the code does are reviewed in the same pull request as that code.

Best fit: instance-wide logging, memory, preload libraries and SSL in the group; query and session limits in migrations or the code that runs the query.

Parameter groups with Encore

Encore

Encore brings infrastructure from code to the database layer: the service declares its database, and on deploy Encore provisions an RDS or Aurora Postgres server in your own AWS account with Multi-AZ, 7-day backups and Performance Insights enabled, as listed in the AWS infrastructure docs. Instance-level settings like max connections and the Postgres version are changed in the Platform Dashboard, a major version upgrade moves the instance onto a parameter group for the new family, and anything else stays editable in the RDS console, as the infrastructure configuration docs describe.

The per-database limits from the previous section fit naturally into the service's migrations, which run as the role that owns the database:

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

-- reports/migrations/2_session_limits.up.sql DO $$ BEGIN EXECUTE format('ALTER DATABASE %I SET statement_timeout = %L', current_database(), '5s'); EXECUTE format('ALTER DATABASE %I SET idle_in_transaction_session_timeout = %L', current_database(), '60s'); END $$;
package reports import ( "context" "encore.dev/storage/sqldb" ) var db = sqldb.NewDatabase("reports", sqldb.DatabaseConfig{Migrations: "./migrations"}) type MonthlyTotals struct { Orders int64 `json:"orders"` Revenue int64 `json:"revenue_cents"` } //encore:api private method=GET path=/reports/monthly func Monthly(ctx context.Context) (*MonthlyTotals, error) { tx, err := db.Begin(ctx) if err != nil { return nil, err } defer tx.Rollback() // This report scans a large table, so it gets a longer limit than the 5s default. if _, err := tx.Exec(ctx, `SET LOCAL statement_timeout = '30s'`); err != nil { return nil, err } var t MonthlyTotals err = tx.QueryRow(ctx, ` SELECT count(*), coalesce(sum(total_cents), 0) FROM orders WHERE created_at >= date_trunc('month', now()) `).Scan(&t.Orders, &t.Revenue) if err != nil { return nil, err } return &t, tx.Commit() }

encore run starts Postgres locally and applies the same migration, so the 5 second limit is in place on a laptop exactly as it is on RDS, and a query that only passes because the local data set is small fails early in a test once the fixture grows. The databases docs cover the rest of the API.

An AI coding agent that adds a heavy query can raise the limit with SET LOCAL in the same diff, and the reviewer sees the timeout next to the SQL it covers instead of in a console setting nobody remembers changing.

Best fit: services on AWS that want server settings handled with the database and query limits versioned alongside the code.

How to approach it

Create one custom group per family before you need it, so the first tuning change is not also the first reboot. Put logging, preload libraries and memory in the group, put statement_timeout and similar limits in migrations or SET LOCAL, and check pending-reboot after every change to a static parameter.

Frequently asked questions

Can I modify the default RDS parameter group?

No. Default parameter groups such as default.postgres17 are read-only. Create a custom DB parameter group from the same family, change the values there and associate it with the instance; switching the group on an instance requires a reboot before the new group takes effect.

What is the difference between static and dynamic parameters in RDS?

Dynamic parameters apply as soon as you save the change, unless you choose to apply them at the next reboot. Static parameters, such as shared_preload_libraries or max_connections, only take effect after the instance reboots, and the console shows the instance as pending-reboot until then.

Should statement_timeout go in the RDS parameter group?

No. A server-wide statement_timeout also hits migrations, backups and admin sessions. Setting it per database or per role with ALTER DATABASE or ALTER ROLE, or per transaction with SET LOCAL, keeps the limit close to the code that depends on it.

How do I set Postgres settings for an Encore database?

Put per-database settings in a migration with ALTER DATABASE on current_database(), and use SET LOCAL inside a transaction for one-off limits. Instance-wide settings stay in the RDS parameter group in your AWS account, which Encore moves to the new family on a major version upgrade.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders