Prompt
How do I choose a time-series database for events, counters, and gauges at scale?
Latest observation
Choosing a time-series database (TSDB) for events, counters, and gauges at scale comes down to matching the database’s write pattern, query pattern, retention needs, and operational model to your workload.
1) Start with the workload shape
Events
- High-cardinality, append-only records
- Often need filtering by tags/labels, time range, and occasional full-text or metadata search
- Examples: clicks, logs-like events, audit records, app events
Counters
- Monotonic or periodically sampled numeric values
- Need rollups, rate calculations, downsampling, and long retention
- Examples: requests/sec, bytes sent, error counts
Gauges
- Point-in-time values that go up/down
- Need “latest value,” min/max/avg over windows, and alerting
- Examples: CPU usage, memory, queue depth
2) Decide what “scale” means for you
Estimate:
- Ingest rate: points/sec, events/sec
- Cardinality: number of unique series/tags
- Retention: days/weeks/years
- Query latency: sub-second dashboards vs. batch analytics
- Concurrency: how many users/services query at once
- Data model: metrics only, or metrics + event context
- Availability: single-region vs. multi-region, HA requirements
A system that handles 100k points/sec with 10k series can behave very differently from one handling 10M points/sec with 100M series.
3) Key evaluation criteria
Write performance
Look for:
- High sustained ingest
- Efficient batching/compression
- Predictable performance under bursts
- Backpressure behavior when overloaded
Cardinality handling
This is often the biggest TSDB bottleneck.
- If you have many unique tag combinations, choose a system designed for high cardinality.
- Check memory usage per series and how it behaves as cardinality grows.
Query model
Ask whether you need:
- PromQL-style metric queries
- SQL for flexible analytics
- Event search/filtering
- Joins or enrichment
- Downsampled views
Retention and downsampling
Important for scale and cost:
- Native TTL/retention policies
- Automatic rollups/downsampling
- Tiered storage (hot/warm/cold)
- Easy archival to object storage
Data correctness
For counters:
- Support for counter resets
- Rate/derivative functions
- Deduplication for at-least-once ingestion if needed
For gauges:
- Efficient aggregation by time window
- Handling sparse data and late arrivals
Operability
Consider:
- Managed vs self-hosted
- Backup/restore
- Upgrades
- Horizontal scaling
- Multi-tenancy and isolation
- Observability of the DB itself
4) Common technology choices by use case
If you want metrics-first monitoring
Good fit:
- Prometheus ecosystem for scraping + alerting
- Mimir / Thanos / Cortex / VictoriaMetrics for scale-out metrics storage
Best for:
- Counters/gauges
- PromQL dashboards and alerting
- Large-scale observability
Tradeoff:
- Not ideal for arbitrary event analytics
If you want event analytics with time as the main dimension
Good fit:
- ClickHouse
- Sometimes Druid or Apache Pinot
Best for:
- Events with rich filtering and aggregations
- Very large volumes
- Ad hoc analytics over event streams
Tradeoff:
- Not a pure metrics TSDB experience; more analytics-oriented
If you need a classic TSDB for operational metrics
Good fit:
- InfluxDB
- TimescaleDB (Postgres-based)
Best for:
- Smaller to medium scale
- Familiar time-series semantics
- SQL in TimescaleDB’s case
Tradeoff:
- Cardinality and very high scale may be limiting depending on workload and edition/setup
If you need cloud-managed observability
Good fit:
- Vendor-managed systems like Datadog, New Relic, Grafana Cloud, etc.
Best for:
- Fast setup
- Managed scaling
- Integrated alerting and dashboards
Tradeoff:
- Cost at scale and vendor lock-in
5) Match database type to data type
Counters and gauges
Prefer:
- Metrics-native TSDB
- Strong aggregation functions
- Efficient storage for numeric samples
Events
Prefer:
- Columnar analytics engine or event store
- Better support for dimensions, filtering, and aggregation over time
Mixed workloads
If you truly need both:
- Use separate systems for metrics and events, or
- Use a system that can handle both reasonably well, like ClickHouse, if your queries are analytics-heavy
This is often the most scalable approach:
- Metrics DB for counters/gauges/alerting
- Event/analytics DB for event exploration and reporting
6) Practical selection rubric
Score each candidate 1–5 on:
- Ingest throughput
- Cardinality support
- Query flexibility
- Latency
- Retention/downsampling
- Operational simplicity
- Cost at scale
- Ecosystem/integrations
- HA and disaster recovery
Then test with your real data shape.
7) Run a proof-of-concept with your real workload
Use real:
- Tag cardinality
- Burst patterns
- Retention window
- Query mix
- Concurrent users
Measure:
- Ingest cost per million points/events
- p95/p99 query latency
- Storage per day
- CPU/memory usage
- Failure recovery time
- Operational burden
8) A simple decision guide
- Mostly metrics, Prometheus-style alerting → Mimir/Thanos/VictoriaMetrics/Prometheus
- High-volume events and flexible analytics → ClickHouse/Pinot/Druid
- SQL + time-series + moderate scale → TimescaleDB
- SaaS and minimal ops → managed observability platform
- Need both event analytics and metrics, but can split systems → best long-term choice
9) Questions to answer before buying/building
- What’s your peak ingest rate?
- How many unique series/tags?
- What retention do you need?
- Do you need alerting on raw samples or rollups?
- Are queries mostly dashboards, ad hoc exploration, or APIs?
- Do you need joins/enrichment?
- Can you split metrics and events into different systems?
- What’s your budget for storage and ops?
If you want, I can give you a shortlist of TSDBs by workload or help you choose one based on your exact ingest/cardinality/query requirements.