Tuning Medplum PostgreSQL parameters with RDS Proxy

Medplum PostgreSQL parameters can be changed on AWS without downtime when the deployment has two or more database instances and RDS Proxy enabled. This page covers the setup, trade-offs and checks.

On this page

How to change Medplum PostgreSQL parameters without downtime

A self-hosted Medplum team that needs to change a database setting such as statement timeout or transaction isolation on a live system can do so without downtime only when the deployment has two or more database instances and RDS Proxy enabled through rdsProxyEnabled. Without both, a parameter change on AWS means restarting the database, and every application connection drops during that restart. The Medplum server currently defaults to a 60 second statement_timeout and REPEATABLE READ default transaction isolation, so these are the two values most teams review first when they tune for their own workload.

According to the Medplum RDS parameters documentation, RDS Proxy sits between the Medplum application servers and the PostgreSQL instances and holds client connections open while the database behind it is changed or failed over. The application keeps its connections to the proxy, so a parameter group change can roll through the instances without the application seeing a full outage. A team needs this when the database must be tuned while clinicians or integrations are using the system, for example after load testing shows that long queries need a different timeout or that a stricter isolation level is required by a clinical workflow. Confirm with your own CDK configuration that rdsProxyEnabled is set and that the stack actually runs at least two database instances before you plan the change window.

How Medplum connections flow through RDS Proxy to PostgreSQL instances

The diagram starts at the Medplum application servers and Redis cache, which connect to RDS Proxy inside the client's AWS account. The proxy routes traffic to the writer and reader PostgreSQL instances, which share a parameter group where the settings are changed. Check that RDS Proxy is enabled through rdsProxyEnabled, that at least two database instances are running, and that the parameter group change is applied to every instance before you rely on it.

Medplum traffic reaches PostgreSQL through RDS Proxy, with parameter changes applied to each instance.

Medplum statement timeout and isolation defaults

The Medplum server ships with a 60 second statement_timeout and REPEATABLE READ as its default transaction isolation level. Both values apply to every connection the server opens, so a change affects the whole application, not one query. Before you raise or lower either setting, confirm the current values in your own deployment, since they are set through the server configuration and the database parameter group, and check that the two agree. The official Medplum RDS parameters documentation describes how these settings are applied on AWS.

A higher timeout keeps long-running work alive but lets a slow query hold locks and pool connections for longer. Before changing it, inventory the workloads that can exceed the current limit: long FHIR searches with broad criteria, bulk data migrations run as part of a Medplum upgrade, and Bot workloads that query large sets of resources. Test each one against a copy of production data and record its runtime, lock behavior and effect on connection pool waits. A lower timeout is safer for interactive traffic but may fail legitimate migrations, so schedule those separately or give them a documented exception path. Isolation changes deserve the same care, because moving away from REPEATABLE READ changes what concurrent writers can observe, which can affect Bot logic that assumes a consistent snapshot.

These settings control how long a query may run and how transactions see each other. They do not provide availability. PostgreSQL does not detect a failed primary or promote a standby by itself, so a timeout change does nothing during a database outage. Confirm with your team which tool performs failover, how clients reconnect after it, and how the timeout behaves during a switchover. Treat the high availability design as a separate decision that the parameter settings support, not replace.

Which PostgreSQL parameter options fit which change

This table compares the five levers available for PostgreSQL changes under Medplum: RDS Proxy, multiple database instances, statement_timeout, default transaction isolation, and a separate pooler. Read each row for when the option fits, what it requires, and the main trade-off before you change a parameter group.

OptionWhen it fitsWhat it requiresMain trade-off
rdsProxyEnabledYou need connections to survive database changes and want parameter updates to avoid downtimeEnabled through the Medplum CDK configuration, with two or more database instancesAdds a managed layer between the Medplum server and PostgreSQL that you must size and monitor
Two or more database instancesYou need zero-downtime parameter changes on AWS or any failover-capable setupA second instance in the cluster, combined with RDS Proxy enabledExtra database cost and more configuration to verify after each change
Changing statement_timeoutLong-running queries are blocking other requests or you need a stricter ceilingMedplum's default is 60 seconds; change the value in the parameter group and test slow FHIR searches firstA lower limit can cancel legitimate large searches, while a higher one lets runaway queries hold connections longer
Changing default transaction isolationYour workload has a documented reason to move away from Medplum's REPEATABLE READ defaultMedplum sets REPEATABLE READ by default; confirm with Medplum before changing itChanging isolation alters how concurrent writes behave, so it needs thorough regression testing
Separate pooler such as PgBouncerYou need pooling beyond what RDS Proxy provides, or a pooler outside AWSA separate service you deploy, configure and monitor, plus confirmation that Medplum works with itAnother component to operate and secure, and pool mode settings can affect session behavior

Trade-offs of RDS Proxy and extra database instances

Changing PostgreSQL settings under Medplum without downtime depends on running more than one database instance and putting RDS Proxy in front of them. Each choice below adds cost, moves latency, or changes what clinical writes can see, so weigh them together before you edit the parameter group.

Cost of extra instances

Zero-downtime parameter changes need two or more database instances, so the second instance is a standing cost, not a one-time one. Ask your cloud team to price the instance class, storage, backups and proxy charges for each environment, including non-production copies if you want to rehearse changes. Confirm current RDS Proxy pricing and which billing components apply to your engine with AWS.

Medplum RDS parameters

Connection behavior through the proxy

RDS Proxy holds a pool of database connections and reuses them, so Medplum's application servers open fewer direct connections during a failover or restart. Test how long-lived sessions, prepared statements and pinned connections behave for your Medplum version and driver settings. Confirm proxy limits, timeouts and pinning rules for your PostgreSQL engine version in the AWS documentation.

Statement timeout and user-facing latency

Medplum defaults to a 60 second statement timeout, which caps how long any single query can run. A longer value lets heavy searches finish but can hold a request, and a pool connection, while users wait. A shorter value fails slow requests sooner and returns errors that clinicians will see. Measure your slowest real queries before you change the value.

Default statement timeout
60 seconds

Isolation level and clinical writes

Medplum uses REPEATABLE READ as its default transaction isolation. Moving to a weaker level can allow different reads within one transaction and changes what concurrent updates to the same record mean. Clinical writes such as orders, medication changes and result acknowledgements need a clear answer on whether a lost update or stale read is acceptable. Have your clinical and compliance owners sign off on any isolation change.

Failover and read traffic

A second instance can serve as a standby, but PostgreSQL does not detect a primary failure or promote a standby by itself, so failover depends on external tooling and on how the proxy routes connections. Decide who owns failover testing, how long the application may retry, and whether readers serve any Medplum traffic. Verify these behaviors in your own environment before go-live.

Setting Medplum PostgreSQL parameters through CDK

This sequence moves a self-hosted Medplum database setting change through CDK in a controlled order, so the statement timeout and isolation values are applied with a proxy in front of the database and confirmed on a live session.

  1. Confirm the Medplum version and deployment method

    Your platform or infrastructure engineer records the running Medplum server version and confirms the deployment uses the AWS CDK and CloudFormation path, since the parameter changes described here depend on it. Check the version against the release listing in the medplum/medplum repository and confirm the minor version sequence is current before editing configuration. Done when the team has a written record of the version, the CDK app repository and the stack name that will receive the change.

  2. Confirm the database has at least two instances

    Before changing anything, the team checks the current RDS instance count in the CDK configuration. Medplum's documented path for zero-downtime parameter changes on AWS requires two or more database instances, so a single-instance deployment needs a planned change in the instance count first, reviewed in a non-production stack. Done when the configuration shows the intended instance count and the team has confirmed with the database owner that the extra instance is provisioned as part of the change.

  3. Enable RDS Proxy in the CDK configuration

    The engineer sets rdsProxyEnabled in the Medplum CDK configuration so client connections pass through RDS Proxy rather than going straight to the database endpoint. Application servers then reconnect through the proxy during a parameter-driven restart, which is the reason the proxy is part of a no-downtime change. Done when the diff from the CDK synth step shows the proxy resource and the application connection string points to the proxy endpoint, not the cluster endpoint.

  4. Define the parameter group values

    The engineer writes the PostgreSQL parameter group values in the CDK code, starting from the Medplum defaults of a 60 second statement_timeout and REPEATABLE READ isolation. Only values the team has tested against its workload should be changed, and each change should be recorded with its reason and an owner. Done when the synth output shows the parameter group with the exact keys and values, and a peer has reviewed the diff against the documented defaults.

  5. Deploy the change through CDK

    The platform team runs the CDK deploy for the Medplum stack in a staging environment first, then in production, watching the CloudFormation events for the parameter group, proxy and instance changes. The team keeps the previous CloudFormation template available so a rollback can be applied if the change fails. Done when the stack reports a successful update and the proxy and database instances show as available in the AWS console.

  6. Verify the proxy endpoint is in use

    The team checks that the Medplum server is connecting through the RDS Proxy endpoint, for example by confirming the configured database host in the running task or container environment and by reviewing the proxy's client connection metrics for new activity. Done when traffic is visible on the proxy and no application server still points at the direct cluster endpoint.

  7. Read statement_timeout and isolation from a live session

    From a session that uses the same connection path as Medplum, the engineer runs SHOW statement_timeout and SHOW default_transaction_isolation and compares the results with the values written in the parameter group. A mismatch usually means the parameter group is not attached to the instance or the change has not been applied to new sessions yet. Done when both values match the parameter group and the result is recorded in the change ticket.

  8. Record the evidence and confirm rollback steps

    The team saves the CDK diff, the deploy log, the proxy confirmation and the live session output in the change record, and confirms who can run the rollback. Operators should also check application error rates and database connection behavior for a period agreed in advance by the team. Done when the change record holds all four pieces of evidence and the on-call owner has acknowledged the rollback path.

Security and operational considerations for database parameter changes

Changing a PostgreSQL parameter under Medplum touches who can deploy infrastructure, how the application authenticates to the database, and how a bad value gets reverted. The cards below cover those controls and the responsibility split that sits underneath them.

Who may change parameter groups

Parameter group changes run through the same CDK stack that deploys the application, so anyone with deploy rights can alter statement_timeout or isolation settings. Restrict production deployments to a named set of engineers, and require a second reviewer on any diff to the database construct. Confirm that your CI system, not individual laptops, performs production cdk deploy runs.

Default statement timeout
60 seconds
RDS parameters docs

How credentials reach the application

The Medplum server authenticates to PostgreSQL through RDS Proxy, so database credentials should be held in AWS Secrets Manager and read by the task role at runtime, not written into environment files or CDK context. Check that the proxy's secret is limited to the server's role and that rotation does not require a redeploy of unrelated services. Decide who can read the secret value, since that access bypasses the proxy entirely.

Audit trail for CDK deployments

Each parameter change should leave a record that links the CloudFormation stack event to a commit, a reviewer and a deploy run. Keep CloudFormation event history and CloudTrail logs for ModifyDBParameterGroup and related API calls in a location the operations team cannot silently edit. Ask your team to show, for any past change, which commit produced it and who approved it.

Rollback path for bad values

A parameter that is too strict, such as a short statement timeout on a long FHIR search, can cause application errors within minutes. Keep the previous parameter group version as a known-good state and rehearse reverting the value in a non-production stack first. Check whether the change applies dynamically or needs a restart, because a restart changes the rollback window and the downtime you should expect.

PostgreSQL high availability docs

Shared responsibility for compliance

Medplum's compliance documentation states that compliance is a shared responsibility between Medplum and its customers. When you self-host, the database configuration, access logs and change records fall on your side, and Medplum's documentation does not transfer them. Ask your compliance lead to map each parameter control to an owner, and confirm your own assessor's scope before relying on any vendor document.

Medplum compliance docs

Which PostgreSQL version to plan around

Before you change any parameter, confirm which PostgreSQL major version your Medplum release supports and which version your database currently runs. PostgreSQL 14 is supported until November 12, 2026, according to the PostgreSQL versioning policy. PostgreSQL 15, 16, 17 and 18 have later end dates, with 18 supported until November 14, 2030. If your database is on 14, a major upgrade is a planning item for the coming months, not a someday task, and parameter tuning on a version that is about to leave support adds rework. Ask your Medplum release notes and self-hosting documentation which majors are certified for the release you run, because the parameter names and defaults in this topic should be checked against that version.

Minor releases are the routine case. They never change the internal storage format, so you replace the executables and restart the server, which is why they fit inside a normal maintenance window. Parameter changes applied through a parameter group are a separate operation, but you should schedule them alongside minor patching so that each restart applies both at once. Major upgrades are different. The documented routes are a pg_dumpall dump and restore, pg_upgrade, or logical replication. The PostgreSQL upgrading guide describes logical replication as the route with the least downtime, with only several seconds of downtime for the cutover. That route needs a second instance on the new major version, replication set up and verified, and a tested switch of the application connection, which RDS Proxy can help you manage. Plan the rehearsal before the upgrade, and confirm the exact steps for your managed service with your cloud provider.

Limits to confirm before changing Medplum database settings

Changing PostgreSQL parameters under Medplum touches the database, the connection layer and the failover path at once. The cards below list what to confirm in your own environment before a change window, so that a parameter edit does not become an unplanned outage.

Medplum version and rdsProxyEnabled support

The zero-downtime path depends on rdsProxyEnabled being present in the CDK stack you deploy. Confirm that your Medplum version exposes this setting, check how your stack was generated, and compare the option names against the release you run. If the key is absent, a parameter change will probably require a restart and a maintenance window.

Default statement timeout
60 seconds
Medplum RDS parameters

Parameters that apply without restart

PostgreSQL treats parameters differently. Some take effect on reload, others need a full restart, and parameter groups on RDS apply changes according to each parameter's apply type. Before you edit statement_timeout or isolation settings, confirm the apply type of each key in your engine version and plan the restart order across instances.

RDS Proxy authentication compatibility

RDS Proxy must accept the authentication method your Medplum clients and database roles use. Confirm which method each role uses, whether it is supported by RDS Proxy for your engine version, and whether credentials are stored in Secrets Manager in the form the proxy expects. Test a login through the proxy before you move production traffic to it.

PostgreSQL auth methods

Connection behavior during writer changes

During a writer change, open sessions may drop and in-flight transactions can fail. Confirm how Medplum's server retries or surfaces these errors, how long the proxy takes to route to the new writer in your region, and whether your load tests reproduce the event. Watch for pooled connections that keep stale state after failover.

Two or more instances for zero downtime

Medplum's documentation ties zero-downtime parameter changes to running two or more database instances with RDS Proxy enabled. Confirm the instance count in your stack, check that the standby is in a separate availability zone, and rehearse the change in a non-production copy so that the reader or writer order is known before the window opens.

No automatic PostgreSQL failover

PostgreSQL does not detect a failed primary or promote a standby by itself. Confirm which component performs promotion in your deployment (managed service behavior or an external failover tool), who is paged when it acts, and how Medplum recovers after promotion. Do not assume that adding a replica gives automatic failover.

PostgreSQL failover docs

Questions teams ask before changing Medplum PostgreSQL parameters

What drives the cost and effort of a Medplum PostgreSQL parameter change?

The main drivers are how many environments you run, how much of the change path is already automated, and how much testing your change process requires. Each parameter touches the database, the application servers and the connection layer, so the effort rises when those pieces are managed by different teams or documented poorly. Cost has two parts: one-time work to set up parameter groups, RDS Proxy and a staged rollout, and recurring work each time you tune a setting again. Ask any partner for a quote that lists the environments in scope, who makes each change, how rollback is handled and which tests run before production. A written scope is the best way to compare options.

Do I need two database instances to change Medplum PostgreSQL parameters?

Medplum's RDS parameter guidance says zero-downtime parameter changes on AWS need two or more database instances with RDS Proxy enabled through rdsProxyEnabled. With a single instance, applying a parameter that requires a restart means the database is unavailable while it restarts. A second instance gives you a place to fail over to while the first one is updated. Adding it also adds cost, because you pay for another instance and its storage, and it changes how replication and failover behave. Confirm the instance class, Multi-AZ setting and replica count with your own capacity plan before you commit to a layout.

How long does a Medplum PostgreSQL tuning change take?

No supplied source gives a duration for this work, so treat any figure you hear as unverified. The time depends on how many parameters you change, whether any require a restart, how many environments must be updated in sequence, and how long your change approval and test cycle take. A change that only needs a reload is quick to apply. A change that needs a restart, followed by a failover test and a load check, takes longer because each step waits for the previous one. Ask for a timeline that separates staging, production and review windows, and confirm it against your own change calendar.

Can an internal team change Medplum PostgreSQL parameters on its own?

Yes, if the team has AWS and CDK skills, access to the Medplum infrastructure code, and a clear way to test the result. The work involves editing parameter groups, enabling RDS Proxy, confirming the Medplum server defaults such as the 60 second statement_timeout and REPEATABLE READ isolation, and checking that connections recover after a change. Teams that have run this before usually find it manageable. Teams that have not often underestimate the test and rollback steps. A partner can help with scope, a staged plan or a review, while your team keeps ownership of the production environment.

What does a Medplum PostgreSQL parameter change need from our AWS account?

The work needs permission to change the CDK stack that defines the database, its parameter groups and RDS Proxy, plus permission to deploy that stack in each target environment. It also needs read access to the current database configuration and CloudWatch metrics so you can compare before and after. Plan for a change ticket, a named approver, a maintenance window where your policy requires one, and a documented rollback path. Confirm with your AWS administrators which IAM roles, service quotas and VPC settings apply, because RDS Proxy adds networking components that your security team will want to review.

Which PostgreSQL version should I plan for before changing Medplum parameters?

Check your PostgreSQL major version first, because parameter names and defaults can differ across releases. According to the PostgreSQL versioning policy, version 14 is supported until November 12, 2026, and version 18 is supported until November 14, 2030. If you run an older major version, plan the upgrade before or alongside the tuning work, since the two changes interact. Minor releases do not change the storage format, but a major upgrade needs its own plan. Confirm the version your Medplum release expects and the version running in each environment before you start.

What goes wrong when Medplum PostgreSQL parameters are changed without testing?

The most common problems are connection failures after a restart, query timeouts that appear only under real load, and isolation changes that alter application behavior. Because Medplum sets a 60 second statement_timeout and REPEATABLE READ by default, lowering or raising these values can affect long-running searches, Bots and batch jobs. Testing should cover a restart, a failover to the second instance, a sustained load run and a check of the application logs for pool errors. Record the results so the change can be reviewed later.

How DeployOpen scopes and supports Medplum database tuning

DeployOpen plans and implements PostgreSQL parameter changes for self-hosted Medplum inside your own AWS account, starting from a written scope. The work covers the parameter group changes, the RDS Proxy layer, the database instance layout and a tested rollback path, with each change documented for your operations team.

How we scope

  • Written scope lists the Medplum version, the current statement timeout and isolation settings, and the workloads to be tuned.
  • Scope confirms whether two or more database instances and RDS Proxy are already in place or must be added.
  • Fixed-scope agreement defines deliverables, change windows and acceptance checks before any database change starts.

How we build

  • Parameter changes are expressed in your CDK code so each setting is reviewed, versioned and reproducible.
  • RDS Proxy is configured with rdsProxyEnabled and tested against your application's connection behavior before cutover.
  • Each parameter change is applied in a non-production environment first, with the before and after values recorded.

How we hand over

  • Deliverables include the CDK diff, a parameter reference listing each changed value and the reason for it.
  • A runbook describes how to roll back each parameter group change and how to confirm the proxy is serving traffic.
  • Your team receives a walkthrough of the monitoring points that show whether the new settings are working as intended.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Retainer work can cover retuning when the Medplum version changes and when database workloads grow.
  • Ask for a quote that separates the one-time tuning engagement from any recurring support hours.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.