PostgreSQL
The Railway PostgreSQL database service allows you to provision and connect to a PostgreSQL database with zero configuration.
Connect
When you run railway run
in a project with the Postgres database service installed, we inject several environment variables.
- PGHOST
- PGPORT
- PGUSER
- PGPASSWORD
- PGDATABASE
- DATABASE_URL
Many libraries will automatically look for the DATABASE_URL
variable and use
it to connect to PostgreSQL. You can also manually use these variables however you
like.
Image
The Postgres database service uses the timescale/timescaledb-postgis:latest-pg13 docker image.
Timescale and PostGIS
All PostgreSQL containers have the PostGIS and Timescale family of extensions installed. This means you can do both geo-spatial and time-series queries out of the box with Railway!
You must enable the extensions in every database you want to use them. For example,
Edit this file on GitHub