What is a time-series database and when do you use one?
Answer
A time-series database (TSDB) is optimized for storing and querying data indexed by time — sequences of data points recorded at successive time intervals. Examples: InfluxDB, TimescaleDB (PostgreSQL extension), Prometheus, QuestDB. Key features: efficient storage of time-stamped data (column-oriented, delta encoding), time-based partitioning (automatic data expiry), fast time-range queries, and built-in downsampling/aggregation functions (average over 1-minute windows). Use cases: IoT sensor data, financial tick data, application metrics/monitoring, server telemetry, and energy consumption tracking. Standard RDBMS can handle small volumes but struggle with millions of inserts per second and long-term retention of billions of time-stamped rows.