<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-metrics-with-timescaledb-yelpbmh4n" -->

---
title: Building Metrics with TimescaleDB | daily.dev
description: Inngest's engineering team describes how they built a metrics system to give users visibility into function throughput, SDK throughput, and throttling...
canonical: https://daily.dev/posts/building-metrics-with-timescaledb-yelpbmh4n
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building Metrics with TimescaleDB | daily.dev
og:description: Inngest's engineering team describes how they built a metrics system to give users visibility into function throughput, SDK throughput, and throttling...
og:url: https://daily.dev/posts/building-metrics-with-timescaledb-yelpbmh4n
og:image: https://api.daily.dev/og/posts/YELPBmh4N.png
og:image:alt: Building Metrics with TimescaleDB
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Building Metrics with TimescaleDB

**[Inngest Blog](https://daily.dev/sources/inngest)** · 12 min read · 0 upvotes · 0 comments

## Summary

Inngest's engineering team describes how they built a metrics system to give users visibility into function throughput, SDK throughput, and throttling indicators. They evaluated Prometheus, InfluxDB, and ClickHouse before choosing TimescaleDB, largely because it's built on Postgres and they already had operational experience with it. The post details their architecture using a metrics server plus the Go tally library, and walks through hard-won lessons: continuous aggregates gave inaccurate deltas when window functions were involved, so they switched to manual window-function SQL; high cardinality from tracking RunIDs caused memory blowups requiring removal of that tag; and removing tags from a schema invalidated existing partitions, forcing a table truncate.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.inngest.com/blog/2023-11-29-metrics-with-timescale>

## Questions this post answers

### Why do TimescaleDB continuous aggregates give inaccurate results when computing counter deltas with window functions?

TimescaleDB cannot run continuous aggregates on queries involving window functions, so functions like delta or interpolated_delta miscalculate deltas by off-by-one bucket boundary errors: delta ignores the previous bucket's last value while interpolated_delta wrongly includes the current bucket's end value, and these small errors compound across many tagged metric variants into significant inaccuracies.

_Teams debugging time-series aggregation accuracy issues follow database internals discussions like this one on daily.dev._

### Why did Inngest choose TimescaleDB over ClickHouse and InfluxDB for a metrics system?

TimescaleDB was chosen because it is built on Postgres, requiring no additional SQL drivers and letting the team reuse existing Postgres operational knowledge and an existing feature already using TimescaleDB. InfluxDB lacked a local development story, and ClickHouse, despite pleasant developer experience, had a harder operational maintenance profile requiring dedicated infrastructure teams.

_Engineers weighing TimescaleDB against ClickHouse or InfluxDB for metrics compare tradeoffs like these on daily.dev._

### Why does removing a high-cardinality tag like RunID from a metrics schema in TimescaleDB require truncating the table?

Removing a tag such as RunID or status from a Postgres/TimescaleDB metrics table drops that column, which destroys the partition context window functions rely on for computing deltas; records that previously wouldn't be compared (different statuses) get merged, making historical deltas wildly inaccurate, so the existing data must be truncated rather than reused.

_Developers reworking metric schemas without corrupting historical deltas watch for gotchas like this on daily.dev._

## Similar posts on daily.dev

- [10 trillion samples a day: Scaling beyond traditional monitoring infra at Databricks](https://daily.dev/posts/10-trillion-samples-a-day-scaling-beyond-traditional-monitoring-infra-at-databricks-nvnrsbnfl) · databricks · 0 upvotes · 0 comments
- [Comparing MongoDB, TimescaleDB, InfluxDB, and CrateDB for an IIoT Use-case](https://daily.dev/posts/comparing-mongodb-timescaledb-influxdb-and-cratedb-for-an-iiot-use-case-h4z5bd7cj) · CrateDB · 0 upvotes · 0 comments
- [Is it over for metrics?](https://daily.dev/posts/is-it-over-for-metrics--hz8oq6ubm) · ClickHouse · 23 upvotes · 1 comments

---

Tags: [#golang](https://daily.dev/tags/golang), [#postgresql](https://daily.dev/tags/postgresql), [#observability](https://daily.dev/tags/observability), [#timescaledb](https://daily.dev/tags/timescaledb)

[View this post on daily.dev](https://daily.dev/posts/building-metrics-with-timescaledb-yelpbmh4n)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Building Metrics with TimescaleDB","url":"https://daily.dev/posts/building-metrics-with-timescaledb-yelpbmh4n","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-metrics-with-timescaledb-yelpbmh4n"},"datePublished":"2026-09-13T19:57:10.014Z","dateModified":"2026-09-13T19:58:26.351Z","description":"Inngest's engineering team describes how they built a metrics system to give users visibility into function throughput, SDK throughput, and throttling...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f9318dc8f114d6caeb2f42473922107a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f9318dc8f114d6caeb2f42473922107a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Inngest Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Inngest Blog","logo":"https://media.daily.dev/image/upload/s--ieZKUa5y--/c_limit,w_256/f_auto,q_auto/v1789329423/logos/inngest?_a=BAMAMicg0","url":"https://daily.dev/sources/inngest"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/building-metrics-with-timescaledb-yelpbmh4n","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"golang,postgresql,observability,timescaledb","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Inngest Blog","item":"https://daily.dev/sources/inngest"},{"@type":"ListItem","position":3,"name":"Building Metrics with TimescaleDB"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/building-metrics-with-timescaledb-yelpbmh4n#faq","mainEntity":[{"@type":"Question","name":"Why do TimescaleDB continuous aggregates give inaccurate results when computing counter deltas with window functions?","acceptedAnswer":{"@type":"Answer","text":"TimescaleDB cannot run continuous aggregates on queries involving window functions, so functions like delta or interpolated_delta miscalculate deltas by off-by-one bucket boundary errors: delta ignores the previous bucket's last value while interpolated_delta wrongly includes the current bucket's end value, and these small errors compound across many tagged metric variants into significant inaccuracies. Teams debugging time-series aggregation accuracy issues follow database internals discussions like this one on daily.dev."}},{"@type":"Question","name":"Why did Inngest choose TimescaleDB over ClickHouse and InfluxDB for a metrics system?","acceptedAnswer":{"@type":"Answer","text":"TimescaleDB was chosen because it is built on Postgres, requiring no additional SQL drivers and letting the team reuse existing Postgres operational knowledge and an existing feature already using TimescaleDB. InfluxDB lacked a local development story, and ClickHouse, despite pleasant developer experience, had a harder operational maintenance profile requiring dedicated infrastructure teams. Engineers weighing TimescaleDB against ClickHouse or InfluxDB for metrics compare tradeoffs like these on daily.dev."}},{"@type":"Question","name":"Why does removing a high-cardinality tag like RunID from a metrics schema in TimescaleDB require truncating the table?","acceptedAnswer":{"@type":"Answer","text":"Removing a tag such as RunID or status from a Postgres/TimescaleDB metrics table drops that column, which destroys the partition context window functions rely on for computing deltas; records that previously wouldn't be compared (different statuses) get merged, making historical deltas wildly inaccurate, so the existing data must be truncated rather than reused. Developers reworking metric schemas without corrupting historical deltas watch for gotchas like this on daily.dev."}}]}
```

