DEV Community

Cover image for Timestream Is Closed to New Customers. Can Plain Postgres on RDS Take Your Time Series?
Polliog for AWS Community Builders

Posted on

Timestream Is Closed to New Customers. Can Plain Postgres on RDS Take Your Time Series?

On June 20, 2025, Amazon Timestream for LiveAnalytics closed to new customers. Existing workloads keep running, but if you start a time series project on AWS today, LiveAnalytics isn't an option. AWS recommends Amazon Timestream for InfluxDB instead.

The migration guide lists three targets: InfluxDB 3, InfluxDB 2, and Aurora or RDS for PostgreSQL. Postgres comes with a label: it's the target for "non-time-series use cases".

A lot of teams already run Postgres on RDS. For them the real question is whether they need a second database at all. So I tested it, with one rule: only use what RDS and Aurora actually let you install. That means no TimescaleDB, which isn't on the RDS or Aurora extension lists for current major versions. What's left is native partitioning, BRIN indexes, pg_partman and pg_cron.

Short version:

  • Ingest isn't the problem. One Postgres instance took about 400,000 rows per second in batches. 1,000 sensors reporting every 30 seconds produce 33.
  • Queries on one device are fast. The last hour of one device takes 0.19 ms at p50. A month of one device from an hourly rollup takes 0.93 ms.
  • The cost is in bytes. Postgres stores a reading in about 92 bytes, heap plus indexes. The same data as Parquet, the format InfluxDB 3 writes, takes about 13. That's 7x.
  • It's still cheaper. For 1,000 devices, RDS Single-AZ comes to about $125 a month. InfluxDB 3 Enterprise on Timestream, at three nodes, costs about $1,445.

Every number here comes from a script, and the SQL that matters is in the post. The details, and where Postgres falls short, are below.

What "plain Postgres" means on RDS

Most Postgres time series guides assume TimescaleDB, and the migration guides from Tiger Data (the company behind it) point to their own cloud. That makes sense: TimescaleDB is what gives Postgres hypertables, columnar compression and continuous aggregates. On RDS and Aurora you can't install it. RDS only installs extensions from its list (plus trusted-language ones through pg_tle), and TimescaleDB isn't on it.

Here's what is on the list, and what each one replaces:

You'd use in TimescaleDB On RDS/Aurora you use
Hypertables (automatic chunks) Native range partitioning + pg_partman to create partitions ahead of time
Retention policies pg_partman retention, which drops whole partitions
Continuous aggregates A rollup table + a refresh procedure scheduled by pg_cron
Columnar compression Nothing. This is the gap

Both pg_partman and pg_cron are supported on RDS and Aurora PostgreSQL 16, 17 and 18 (RDS docs for pg_partman and pg_cron, Aurora extension list). pg_cron needs shared_preload_libraries in a custom parameter group and a reboot. AWS has written about this pattern since 2021. This post adds current numbers, rollups, retention and a price comparison.

The setup: devices write into a readings table partitioned by day. pg_partman creates partitions ahead and drops the ones older than 30 days. A pg_cron job refreshes an hourly rollup table every hour. Dashboards read recent data from the raw table and long ranges from the rollup

The test

  • Data: 1,000 devices, one reading every 30 seconds, 30 days. That's 86.4 million rows, about 2.9 million a day.
  • Row: a timestamp, a device id, and five values (temperature, humidity, pressure, battery, signal strength).
  • Machine: 4 vCPU Intel Xeon @ 2.30GHz, 15 GB RAM, local SSD. That's roughly the shape of a db.m7g.xlarge (4 vCPU, 16 GiB).
  • Postgres: 16.15 with pg_partman 5.0.1 and pg_cron 1.6. Aurora PostgreSQL 16 ships the same two extensions. Config: shared_buffers = 4GB, max_wal_size = 2GB, everything else default.

The caveat up front: RDS storage is EBS. gp3 starts at 3,000 IOPS, which is slower than a local SSD. The query numbers below are with a warm cache, which is what dashboards over recent data usually see. Cold scans over months of raw data will be slower on RDS than here.

Schema

CREATE TABLE readings (
  ts          timestamptz NOT NULL,
  device_id   int         NOT NULL,
  temperature real,
  humidity    real,
  pressure    real,
  battery     real,
  rssi        smallint
) PARTITION BY RANGE (ts);

SELECT partman.create_parent(
  p_parent_table    => 'public.readings',
  p_control         => 'ts',
  p_interval        => '1 day',
  p_premake         => 3,
  p_start_partition => '2026-11-03 00:00:00+00'
);
Enter fullscreen mode Exit fullscreen mode

There are daily partitions, and pg_partman keeps three future days created. I used a wide row (one column per metric) rather than one row per metric. It's what you'd model in Postgres anyway, and it keeps the row count honest.

Two indexes, picked for two kinds of query

-- "one device, a time range": most dashboard and API queries
CREATE INDEX readings_device_ts ON readings (device_id, ts DESC);
-- "every device, a short time range": fleet-wide recent data
CREATE INDEX readings_ts_brin ON readings USING brin (ts) WITH (pages_per_range = 32);
Enter fullscreen mode Exit fullscreen mode

The BRIN index is the time series trick in plain Postgres. Rows arrive in time order, so each block of the table covers a narrow time range, and BRIN only stores the min and max per range of blocks. On 86.4 million rows:

Index Size
B-tree on (device_id, ts) 2,600 MB
B-tree on ts (for comparison, not kept) 604 MB
BRIN on ts 1.3 MB

The BRIN index is about 470 times smaller than a B-tree on ts, and it still earns its place: the "latest reading of all devices" query below uses it. Partition pruning picks the day, BRIN picks the last five minutes inside it. It only works because the data is in time order, so don't use it on a table where old rows get updated or backfilled out of order.

Ingest: not the bottleneck

I measured ingest with pgbench, into the partitioned table with both indexes in place, for 60 seconds per run. Each batch is one "tick", one reading from each of the 1,000 devices, with time moving forward like a live feed.

Write pattern Clients Rows per second
Batch of 1,000 rows per INSERT 1 200,000
Batch of 1,000 rows per INSERT 4 397,000
Batch of 1,000 rows per INSERT 8 309,000
One row per INSERT, autocommit 8 15,900
One row per INSERT, autocommit 32 23,600

Throughput peaks at 4 clients on 4 vCPUs. pgbench ran on the same machine, so past that the clients and the server compete for the same CPUs.

For scale: 1,000 devices every 30 seconds is 33 rows per second. 10,000 devices every 10 seconds is 1,000. Even the naive one-row-per-insert client has more than 10x headroom at the larger size. Batch your writes anyway: one client sending batches beat 32 clients sending single rows by more than 8x.

Queries

These are 30-second pgbench runs with 4 clients and a random device per query. I ran the heavy fleet-wide scan 5 times with one client.

Query Rows read p50 p95
One device, last hour (raw) 120 0.19 ms 0.31 ms
Latest reading of all 1,000 devices 10,000 3.23 ms 4.99 ms
One device, 24 h in 5-minute buckets (date_bin) 2,880 4.36 ms 5.71 ms
One device, 30 days daily min/max (raw) 86,400 272 ms 494 ms
One device, 30 days daily min/max (rollup) 720 0.93 ms 1.42 ms
Whole fleet, 7 days hourly average (raw) 20.2 M 1,257 ms 1,307 ms
Whole fleet, 7 days hourly average (rollup) 168,000 59 ms 95 ms

Query latency at p50 on a log scale. Raw queries on recent data of one device take under 5 ms. Long ranges on raw data take 272 ms for one device and 1.26 s for the whole fleet. The hourly rollup brings them to 0.93 ms and 59 ms

Queries on recent data or a single device are fast without any help: the (device_id, ts) index and partition pruning do the work. Problems start when a query reads a lot of raw rows, such as a month of one device or a week of the whole fleet. A row store reads every column of every row, and on a dashboard it shows. The fix is the same as in every time series database: aggregate in advance.

Continuous aggregates, built by hand

TimescaleDB calls them continuous aggregates. InfluxDB 3 does it with plugins in its processing engine. In plain Postgres it's a table, a procedure and a cron job:

CREATE TABLE readings_1h (
  bucket      timestamptz NOT NULL,
  device_id   int         NOT NULL,
  n           int         NOT NULL,
  temp_avg    real, temp_min real, temp_max real,
  hum_avg     real,
  battery_min real,
  PRIMARY KEY (device_id, bucket)
);

CREATE OR REPLACE PROCEDURE refresh_readings_1h(upto timestamptz, lookback interval DEFAULT '2 hours')
LANGUAGE sql AS $$
  INSERT INTO readings_1h
  SELECT date_trunc('hour', ts), device_id, count(*),
         avg(temperature), min(temperature), max(temperature),
         avg(humidity), min(battery)
  FROM readings
  WHERE ts >= date_trunc('hour', upto - lookback) AND ts < upto
  GROUP BY 1, 2
  ON CONFLICT (device_id, bucket) DO UPDATE
    SET n = EXCLUDED.n, temp_avg = EXCLUDED.temp_avg, temp_min = EXCLUDED.temp_min,
        temp_max = EXCLUDED.temp_max, hum_avg = EXCLUDED.hum_avg,
        battery_min = EXCLUDED.battery_min;
$$;

SELECT cron.schedule('rollup-1h', '5 * * * *', $$CALL refresh_readings_1h(now())$$);
Enter fullscreen mode Exit fullscreen mode

Each run re-aggregates the last two hours. Late readings that land in the previous hour get counted, and running it twice changes nothing. The current hour's bucket stays partial until the next run, so a dashboard should either leave out the current hour or read it from the raw table. It took about 200 ms per run here. Backfilling all 30 days the first time took 57 seconds. The rollup holds 720,000 rows in 78 MB, and you can keep it far longer than the raw data.

Keep n (the row count) in the rollup. Without it you can't correctly combine hourly averages into daily or fleet-wide ones. The fleet query above uses sum(temp_avg * n) / sum(n), not avg(temp_avg).

Retention: drop partitions, never DELETE

Partitioning pays off most on the day old data has to go. I measured both ways of removing one day (2.88 million rows), each inside a transaction that I rolled back:

Time WAL written
DELETE ... WHERE ts < ... 1.24 s 304 MB, plus dead rows left for vacuum
DROP TABLE of the partition 1.3 ms 101 kB

With pg_partman you don't write either one by hand:

UPDATE partman.part_config
SET retention = '30 days', retention_keep_table = false
WHERE parent_table = 'public.readings';

SELECT cron.schedule('partman', '15 * * * *', $$CALL partman.run_maintenance_proc()$$);
Enter fullscreen mode Exit fullscreen mode

The same job creates the next partitions and drops the expired ones. On RDS, pg_cron runs jobs in the database set in cron.database_name (the default is postgres), so set it to your database in the parameter group.

Where Postgres falls short: bytes

This is the part the rest of the post doesn't fix. Per stored reading:

Bytes per row
Postgres heap 60.26
+ B-tree (device_id, ts) 31.55
+ BRIN ts 0.02
Postgres total 91.83
Same day as Parquet, zstd, sorted by device and time 12.87

Storage per reading: Postgres uses 91.83 bytes (60.26 heap, 31.55 B-tree, 0.02 BRIN). The same data as Parquet with zstd uses 12.87 bytes, 7.1 times less

InfluxDB 3 persists data as Parquet on object storage, so I exported one day partition to Parquet as a proxy. It's not InfluxDB's exact layout, but it's the right order of magnitude. Postgres spends about 24 bytes of header on every row and doesn't compress. Parquet stores each column together, and timestamps that grow by 30 seconds or a temperature that barely moves compress very well.

At 1,000 devices that's 8 GB against 1 GB a month, and nobody cares. At 10,000 devices every 10 seconds kept for a year, it's 2.9 TB against about 400 GB, and that's where the comparison changes. A full scan over a year of raw rows also takes long enough that you'll want the rollups regardless.

What it costs

These are us-east-1 on-demand prices from the AWS Price List API, for 730 hours a month. The model is simple: hourly price × hours, plus stored GB × storage price.

Two things surprised me in the price list. First, compute costs about the same on both sides. An InfluxDB 2 instance, db.influx.large, costs $0.239 an hour, exactly the same as db.r7g.large on RDS. An InfluxDB 3 node of the same size, db.influxIOIncluded.large, costs $0.264. Second, InfluxDB 3 has two very different editions on Timestream:

  • InfluxDB 3 Core is a single node, has no license fee and has no compactor. AWS's own walkthrough positions it for "the last 3-5 days" of data.
  • InfluxDB 3 Enterprise runs as a multi-node cluster across Availability Zones, with compaction for long history. It adds a license sold through AWS Marketplace at $0.198 per vCPU-hour. Storage goes to S3 at $0.023 per GB-month.

I priced Enterprise at three nodes, the shape AWS uses in its own example. Postgres is priced as RDS with gp3 storage plus 25% headroom.

Scenario Rows kept RDS Single-AZ RDS Multi-AZ InfluxDB 3 Core (1 node) InfluxDB 3 Enterprise (3 nodes)
A: 1k devices, 30 s, 30 days 86 M $125 $251 $193 $1,445
B: 10k devices, 10 s, 30 days 2.6 B $383 $766 $386 $2,892
C: 10k devices, 10 s, 1 year 31.5 B $765 $1,530 $395 $2,900

Instances: A uses db.m7g.large / db.influxIOIncluded.large, B and C use db.r7g.xlarge / db.influxIOIncluded.xlarge.

Monthly cost in us-east-1 for three scenarios. RDS Single-AZ: $125, $383, $765. RDS Multi-AZ: $251, $766, $1,530. InfluxDB 3 Core: $193, $386, $395. InfluxDB 3 Enterprise: $1,445, $2,892, $2,900

How to read it:

  • At the small end, RDS is the cheapest option, and even with a Multi-AZ standby it costs a sixth of Enterprise. If you already run RDS, adding the table to an existing instance may cost close to nothing.
  • InfluxDB 3 Core looks cheap in scenario C, but read the fine print. It has no compactor, and AWS sizes it for days, not a year. I list it because it's the edition a price comparison will show you first.
  • Enterprise costs more mostly because of the license. In scenario A it's $867 of the $1,445. What you get for it is compaction, multi-node HA and a database built for this one job.
  • Scenario C with raw Postgres is the wrong design. Nobody should keep 31.5 billion raw rows in a row store for dashboards. Keep 30 days raw and the hourly rollup for the year, and C costs about the same as B.

So, which one?

Stay on Postgres (RDS or Aurora) if:

  • Your time series sits next to relational data you join against: devices, customers, sites, alerts. This is the strongest reason, because a second database means a pipeline between the two.
  • Most queries are "one entity, recent window". These came back in under 5 ms here.
  • You can live with rollups for long ranges, and with storage growing about 7x faster than in a columnar engine.
  • You're under a few thousand rows per second and a few hundred GB of raw data.

Pick Timestream for InfluxDB 3 if:

  • You keep months or years of raw data and query across all of it. Columnar storage and compaction are exactly what Postgres lacks here.
  • Ingest is the hard part: high cardinality, tens of thousands of series that come and go.
  • Time series is the whole product, not a table in your app. Then the Enterprise license is a fair price for not building rollups, retention and compaction yourself.

The AWS migration guide puts Postgres down for "non-time-series use cases". For a lot of real workloads, the ones with a few thousand devices and a dashboard, that label is too cautious. Postgres on RDS handles them, provided you partition, use BRIN, roll up and drop partitions instead of deleting.

How I measured

The benchmark is a handful of small scripts, mostly plain psql and pgbench:

  • 01_schema.sql: the table and pg_partman setup shown above
  • 02_load.sh: 30 days of synthetic readings, generated with generate_series
  • 03_indexes.sql: the two indexes, plus a throwaway B-tree on ts for the size comparison
  • 04_rollup.sql: the rollup, its refresh procedure and the pg_cron jobs shown above
  • 05_queries.sh: the seven queries with pgbench, p50 and p95 from its per-transaction log
  • 06_retention.sql: DROP vs DELETE, each in a rolled-back transaction
  • 07_parquet_day.py: one day exported with COPY and written as Parquet with pyarrow
  • 08_ingest.sh: batched and single-row inserts, 60 seconds of pgbench each
  • costs.py: the cost table

Next Saturday's post takes this one step further. "Just use Postgres" is good advice, but on RDS the extension list decides what "Postgres" means. I'll go through what's missing (TimescaleDB is only the first) and what to use instead.

Top comments (0)