---
title: Deploy TimescaleDB with AI on Blossom
url: "/deploy/timescaledb/"
canonical_url: https://blossom88.com/deploy/timescaledb/
markdown_url: https://blossom88.com/deploy/timescaledb.md
summary: Store time-series data in PostgreSQL and query hourly averages after an update.
categories:
- deployment
- databases
stack:
- PostgreSQL
- SQL
---

# Deploy TimescaleDB with AI on Blossom

[TimescaleDB](https://github.com/timescale/timescaledb) is a PostgreSQL
extension for timestamped data such as sensor readings and application
metrics. A hypertable partitions rows into time ranges.

## Ask Your Agent

> **Ask your AI agent:** Deploy TimescaleDB on Blossom and help me group sample sensor readings by hour.
>
> Follow this guide: https://blossom88.com/deploy/timescaledb/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#connect-your-provider).

## How It Runs

| Part | Role | Where |
|---|---|---|
| TimescaleDB | Store and query time-series data | Private Persistent Service |
| PostgreSQL client | Write sample data and read hourly averages | Blossom Job |

## Deploy TimescaleDB

Use the official `-oss` image for
[TimescaleDB Apache 2 Edition](https://www.tigerdata.com/docs/get-started/choose-your-path/timescaledb-editions).
Keep PostgreSQL private and use a
[Persistent Service Volume](/docs/apps/persistent-services/) for the
database files.

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

Use a compatible PostgreSQL major version and pin the image. With the
PostgreSQL 18 lightweight image, mount the Volume at
`/var/lib/postgresql`. Set the database password through Blossom
Variables and Links and keep it stable. Run a PostgreSQL client Job to
check the private connection on port `5432`.

    blossom environment:deploy --id environment-100 --follow

</details>

## Group Sample Readings by Hour

Create a hypertable, insert a few timestamped readings, and use
[`time_bucket`](https://www.tigerdata.com/docs/reference/timescaledb/hyperfunctions/time-series-utilities/time_bucket/)
to calculate an hourly average.

> **Ask your AI agent:** Help me insert sample readings and show the count and average temperature for each hour.

> Follow this guide: https://blossom88.com/deploy/timescaledb/



![Group five temperature readings into two hourly averages.](/deploy/assets/images/timescaledb/hourly-aggregates.webp)

## Read the Same Averages After an Update

Replace the database Container and run the query again on the same
Volume. Confirm the two hourly averages and their row counts.

> **Ask your AI agent:** Check that I get the same hourly averages after a Container replacement.

> Follow this guide: https://blossom88.com/deploy/timescaledb/



![Read the same averages after replacing the database Container.](/deploy/assets/images/timescaledb/aggregates-after-replacement.webp)

## What You Get

A private PostgreSQL database that keeps timestamped readings on a
Volume and answers time-bucketed queries in SQL.

## What You Get

- A private TimescaleDB Apache 2 Edition database
- A sample hypertable with hourly temperature averages
- The same query results after replacing the database Container

Tested on Blossom: Five readings returned the same two hourly averages after replacing the database Container.
