Railway

Deploy TimescaleDB [Updated Aug '26]

TimescaleDB [Aug '26] (Time-Series Database Built on Postgres) Self Host

Deploy TimescaleDB [Updated Aug '26]

Just deployed

/var/lib/postgresql/data

Deploy and Host TimescaleDB Self-Hosted on Railway

TimescaleDB is a time-series database built directly into Postgres as an extension, not a separate database with its own query language. It adds hypertables, native compression, and continuous aggregates on top of full Postgres compatibility, so every existing Postgres client, driver, and ORM keeps working exactly as before.

About Hosting TimescaleDB-Self-Hosted

Tiger Cloud, Timescale's own managed service, starts at $30/month for its Performance tier, which caps out at 8 CPU, 32GB memory, and 16TB storage per service. The Scale tier starts at $36/month but only unlocks unlimited database services and higher throughput at that price. Self-hosted TimescaleDB on Railway costs a flat infrastructure fee no matter how much data you ingest or how many queries you run.

The pricing gap isn't the only reason to self-host a time-series database specifically. Time-series data, sensor readings, application metrics, financial ticks, tends to accumulate fast and get queried constantly by internal dashboards and alerting systems. Keeping that data and those query patterns on infrastructure you control, rather than routed through a managed vendor's own compute, matters more here than it does for a database you touch occasionally.

It's worth being direct about something easy to miss when picking a TimescaleDB image: some published variants are trimmed -oss builds that drop compression and continuous aggregate policies, both licensed under Timescale's source-available terms rather than pure Apache 2.0. This template runs the full official image instead, the same one the existing Railway reference template (247 real deploys) uses, so compression and continuous aggregates work out of the box under Timescale's free self-hosted license, not a stripped-down build missing half the reason to pick TimescaleDB in the first place.

This isn't a small or unproven project either. TimescaleDB has real production traction in observability, IoT, and fintech, it's the extension most Postgres teams reach for first when a plain table starts slowing down under time-ordered data at scale. That matters for infrastructure you're depending on: an actively maintained extension keeps working as Postgres itself ships new major versions, a smaller project can fall behind.

Common Use Cases

  • IoT and sensor data: Ingest high-frequency device readings into hypertables that stay fast to query even at billions of rows.
  • Application and infrastructure metrics: Store and query time-stamped metrics without standing up a separate metrics-specific database alongside your existing Postgres.
  • Financial and market data: Tick-level or OHLCV data where time-ordered queries and downsampling need to stay fast as history grows.
  • Event and log analytics: Store structured event streams and roll them up into hourly or daily aggregates with continuous aggregates.
  • Any app already on Postgres outgrowing plain time-ordered tables: Convert an existing table into a hypertable in one function call, no migration to a different database system required.

Dependencies for TimescaleDB-Self-Hosted Hosting

  • Nothing beyond Postgres itself, TimescaleDB is a single self-contained image.
  • No separate cache, queue, or coordination service needed to run it.

Deployment Dependencies

This template provisions a single service running Timescale's own official Docker image, with a persistent Railway volume attached automatically. Reference: TimescaleDB GitHub Repository, TimescaleDB Docker Docs, Timescale Docs.

Implementation Details

This template runs timescale/timescaledb:2.29.0-pg18, Timescale's own official image, confirmed via Docker Hub's own tags API as matching the current latest-pg18 digest at authoring time, not a stale or third-party rebuild. PGDATA is set to a subdirectory of the volume mount rather than the mount root itself, a raw mount at the root leaves a lost+found directory that breaks initdb, an already-established lesson from this project's other raw-Postgres-based templates. The start command unsets both PGPORT and PGHOST before launching Postgres, reused directly from the existing reference Railway template's own already-proven fix (247 real deploys) rather than reinvented, Railway injects its own PGPORT variable that collides with Postgres's entrypoint script reading the same variable natively.

How TimescaleDB Compares to the Alternatives

Vs. InfluxDB: InfluxDB uses its own query languages (Flux or InfluxQL) and is purpose-built for time-series only. TimescaleDB uses standard SQL and can join time-series data directly against normal relational tables in the same query, useful the moment your metrics need to relate to users, devices, or accounts stored elsewhere.

Vs. plain Postgres with no extension: A single large time-ordered table in vanilla Postgres slows down as it grows past a few hundred million rows. Hypertables automatically partition by time under the hood while querying exactly like a normal table, no query rewrites needed to get the benefit.

Vs. a managed time-series service (Tiger Cloud, AWS Timestream): Managed options handle backups and scaling for a per-service fee, Tiger Cloud starts at $30/month for a single service. Self-hosted TimescaleDB on Railway has no per-service tier, one flat infrastructure cost regardless of how many hypertables or how much history you keep.

Getting Started

After deploying, copy the DATABASE_URL variable from this service's Variables tab and connect with any Postgres client, psql, a GUI tool, or your app's own ORM, the connection works exactly like any other Postgres database because it is one.

Convert an existing table into a hypertable with SELECT create_hypertable('your_table', 'time_column');. This is the one TimescaleDB-specific step, everything else, inserts, selects, joins, indexes, works exactly as it would on a plain Postgres table.

If you're planning to keep a long history of data, set up a compression policy early rather than after storage becomes a problem. ALTER TABLE your_table SET (timescaledb.compress); followed by an add_compression_policy call handles this automatically going forward, no manual archival scripts to maintain.

For dashboards or rollup queries that run often, a continuous aggregate saves recomputing the same rollup from raw data every time. Create one with CREATE MATERIALIZED VIEW ... WITH (timescaledb.continuous) AS SELECT time_bucket(...) ..., it stays incrementally up to date as new data arrives.

One thing worth testing directly given how time-series workloads actually get used: insert a realistic burst of data, run the query pattern your dashboard or alerting system will actually use, and confirm it stays fast. A quick single-row test doesn't tell you much about how a hypertable performs under a real ingest and query load.

Why Deploy TimescaleDB-Self-Hosted on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying TimescaleDB-self-hosted on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

Frequently Asked Questions

Do I need to run CREATE EXTENSION myself after deploying?

No. Timescale's own official image pre-creates the timescaledb extension in the default database and in any database created afterward, confirmed directly in Timescale's own documentation.

Why does this template use the full image instead of the -oss variant?

Because the -oss build drops compression and continuous aggregate policies, both licensed under Timescale's source-available terms, not the pure Apache 2.0 core. The full image includes them free for self-hosted use, matching what the existing reference Railway template itself runs.

Will my data survive a redeploy?

Yes, a Railway volume is mounted at the Postgres data directory, so hypertables and all other data persist across redeploys and restarts.

Can I connect from outside Railway with psql or a BI tool?

Yes, enable a TCP Proxy under this service's Settings → Networking in the Railway dashboard, then connect using the generated proxy connection details rather than the private DATABASE_URL.

Does TimescaleDB replace my existing Postgres database?

Not necessarily. Many teams run TimescaleDB as their primary Postgres database and use hypertables only for the time-series tables that need them, relational tables work exactly as they would in plain Postgres alongside them.

Is compression really free to use self-hosted?

Yes, this template runs the full image under Timescale's source-available self-hosted license, which includes compression and continuous aggregate policies at no cost and no row limit.

Where can I download TimescaleDB?

Source code is at github.com/timescale/timescaledb, with Docker images published to Docker Hub under timescale/timescaledb. This template pulls a specific verified version automatically.

What Postgres version does this template run?

Postgres 18, TimescaleDB's own current supported major version, confirmed against Docker Hub's tags API as matching the latest-pg18 digest at authoring time rather than an older pinned release drifting out of date.

Does hypertable partitioning require any application changes?

No. Once a table is converted with create_hypertable, every existing insert, select, and join keeps working exactly as it did before, the chunking happens transparently underneath the same table name and schema.


Template Content

More templates in this category

View Template
Garage S3 Storage
Ultra-light S3 server: fast, open-source, plug-and-play.

PROJETOS
7
View Template
Redis
Self Host Latest Redis with Railway

Arloodots
1
View Template
Postgres Backup to Cloudflare R2 (S3-Compatible)
Automated PostgreSQL backups to S3-compatible storage with encryption

Artour
7