Railway Adds High Availability, Recovery and Query Tools for Managed Postgres
Railway’s Postgres service now covers scaling, failover, point-in-time recovery, upgrades and query analysis, with dashboard, CLI and agent workflows.

Railway’s Postgres service now covers more of the work that begins after a database is running: managing connection pressure, recovering from data loss, handling upgrades and finding costly queries. The changes add a path from a single database node to a highly available cluster, with dashboard controls and command-line or agent workflows for many of the same tasks.

That breadth may reduce routine database operations for teams already using Railway. It doesn’t remove the need to plan for interruptions: failovers drop open connections, major upgrades take the database offline, and point-in-time recovery only covers data changes made after recovery has been enabled and its first backup completed.
Start with a private database connection
A Postgres service can be deployed alongside an application with persistent storage. Railway maintains its Postgres image, which is based on the Postgres image maintained by the project. Applications can reference database variables directly, avoiding manual credential copying. When credentials need rotating, Railway can regenerate them by changing the database password and updating the related connection variables together.
New databases are reachable only through the environment’s private network by default. A BI tool or an application hosted elsewhere can connect through a public TCP proxy when external access is needed. For local work, the Railway CLI can connect to the database from a terminal.
This setup makes the connection path a configuration choice: keep traffic inside the environment where possible, and expose a route for clients that need to connect from outside. Referenced variables also make it easier to keep applications aligned with credential changes.
Scale resources and manage connection pressure
Railway says Postgres can scale vertically up to the service’s resource limits without manual resizing. CPU and memory are billed according to usage, and the dashboard exposes resource and disk metrics. Teams can set monitors to alert when CPU, memory or disk usage crosses a chosen threshold.
Storage can be expanded while the database remains online through live volume resizing. That helps avoid scheduling downtime simply to increase disk capacity, though teams still need to watch usage and make changes before the volume fills.
Connection limits are a separate scaling concern. Each application service and replica can open its own database connections, so adding application capacity may increase connection demand even when Postgres has enough CPU, memory and disk space. Railway offers PgBouncer as a pool between applications and Postgres. It lets many client connections share a smaller number of database connections.
Railway handles provisioning and updates service variable references to route traffic through PgBouncer. Teams can adjust the pool mode and size or add pooler replicas as demand changes. A separate DATABASE_UNPOOLED_URL preserves a direct database connection for migrations and other operations that require a dedicated session.
High availability keeps a node failure from defining the service
Vertical scaling gives one database node more capacity, but it doesn’t address that node becoming unavailable. Railway’s high availability conversion turns an existing Postgres service into a cluster while retaining its data on the existing node, which becomes the cluster’s primary. The conversion flow takes a backup and stages the selected cluster size for review before deployment.
Under the hood, the cluster combines Postgres streaming replicas managed by Patroni, an etcd cluster for leader election and HAProxy for routing connections. Railway provisions and connects these parts, then updates application variable references to use the cluster. Existing PgBouncer setups continue to work, and applications can retain the same connection URL.
If the primary fails, Patroni promotes a replica and HAProxy routes new connections to it through the same application endpoint. When the failed node recovers, it can rejoin as a replica. The cluster view shows each member’s health and role, and supports changing cluster size, performing a coordinated switchover or returning to a standalone database.
Applications still need reconnect and retry handling. Connections that were open during failover are dropped, so the stable endpoint doesn’t preserve in-flight sessions. For workloads that can direct reads to replicas, Railway’s open-source HA template also provides a read-only HAProxy port. The normal endpoint continues to route both reads and writes to the primary.
Backups and point-in-time recovery address different mistakes
Replicas copy writes as they happen. That helps with node failure, but it also means a damaging migration can reach every replica. Scheduled and on-demand backups provide restore points, with daily, weekly and monthly schedules available. Railway describes the backups as incremental and based on copy-on-write storage, so unchanged data isn’t stored again for each snapshot.
Point-in-time recovery (PITR) can restore the database to a selected time between snapshots. Enabling it configures a storage bucket and continuous write-ahead log (WAL) archiving. The system uses pgBackRest for weekly full backups and daily differential backups, retaining roughly four weeks of history.
Coverage begins only after the first base backup has completed and WAL archiving is available. Enabling PITR restarts a standalone database; on a high availability cluster, Railway rolls through the members, with a brief interruption during switchover. Those requirements make it sensible to enable recovery coverage before a risky change, rather than treating it as a way to retrieve data from before PITR was active.
A restore to an earlier timestamp creates a separate service and replays WAL to the chosen point while the original database remains online. Teams can inspect the recovered data and copy back needed records, or move the application to the restored service. A restore from a high availability cluster produces a standalone database, so teams must enable high availability and PITR again if they want those protections after cutover.
Railway also retains deleted volumes for 48 hours and sends a restoration link. That offers a limited recovery path for accidental volume deletion, including deletion through the API.
Routine updates and major upgrades have different costs
Scheduled image updates let teams choose an update policy and maintenance window. Railway checks the configured image for changes and redeploys within that window. Teams can skip a version and receive a notification when an update is applied. Automatic CVE patching handles security fixes when Railway receives a CVE notification with a known mitigation, with a notification and email sent afterward.
These updates stay within the same Postgres major version. A major version can change the on-disk format, so it requires a separate upgrade process. Railway’s major upgrade flow runs compatibility checks for issues such as incompatible extensions, prepared transactions and logical replication slots. After the checks pass and the operator confirms, Railway takes a backup, stops the database, runs pg_upgrade, redeploys on the selected version and takes another backup once service resumes.
For a cluster, Railway upgrades the primary and rebuilds its replicas before automatic failover resumes. The database is unavailable during the upgrade, so timing it for a low-traffic period can limit user impact. A limited revert window allows restoration of the pre-upgrade backup, but writes made since the upgrade will be discarded. Logical replication slots don’t carry over, so consumers that depend on them need new slots after the upgrade.
Query statistics connect symptoms to application behavior
The Query Statistics panel in the database’s Stats tab lists expensive queries alongside call counts, returned rows and execution timings. It can enable pg_stat_statements if the extension isn’t active, though doing so restarts the database.
Putting frequency beside execution time helps teams prioritize. A query that takes 20 milliseconds per call may consume more database time in aggregate if it runs millions of times than a slower report that runs rarely. The statistics can point toward a missing index, a query that needs rewriting or an application path that calls the database too often.
CLI and agents extend the operational workflow
The Railway CLI includes commands to inspect high availability status, PITR coverage and PgBouncer utilization. Its Postgres commands can also convert a database to high availability, scale nodes, change pool settings and restore to a timestamp. Project, environment and service selectors identify the target database, while --json provides structured output for scripts and agents.
railway postgres ha status --service postgres
railway postgres pitr status --service postgres
railway postgres pgbouncer status --service postgresA restore command can create a new service from a point 30 minutes in the past, as long as that point falls within the database’s recovery coverage:
railway postgres pitr restore --service postgres --at 30mFor direct access, railway connect postgres opens a shell. The --tunnel-only option provides a private SSH tunnel for tools such as TablePlus, DBeaver and pgAdmin.
Railway’s MCP server and agent skills give a connected agent access to platform workflows for database investigation. The agent can check connection pressure, expensive queries, blocked transactions, cache misses and vacuum health, then correlate findings with resource metrics and logs. Query analysis uses pg_stat_statements when it’s enabled. This can shorten the path from an alert to a useful diagnosis, though teams still need to review any proposed changes against their workload.
Railway’s expansion makes the service more capable across the database lifecycle, from initial connection to recovery and performance investigation. The practical measure will be how well these workflows fit each team’s tolerance for downtime, its application retry behavior and the recovery coverage it has enabled before problems occur.