Time Series Databases (InfluxDB, TimescaleDB, ClickHouse)


Time-Series Data

Time-series data is a sequence of data points indexed by time. Examples include server metrics, IoT sensor readings, and financial tick data.

Database Comparison

| Feature | InfluxDB | TimescaleDB | QuestDB | |---------|----------|-------------|---------| | Architecture | Custom TS engine | PostgreSQL extension | Columnar | | SQL | Flux / SQL | Full SQL | SQL | | Write throughput | Very high | High | Very high | | Compression | Excellent | Good | Excellent |

InfluxDB

Purpose-built time-series with automatic downsampling:




from influxdb_client import InfluxDBClient




client = InfluxDBClient(url="http://localhost:8086", token="my-token")


write_api = client.write_api()




p = Point("cpu").tag("host", "server01").field("usage_user", 45.2)


write_api.write(bucket="metrics", record=p)





TimescaleDB

PostgreSQL extension with hypertables:




CREATE TABLE sensor_data (


time TIMESTAMPTZ NOT NULL,


device_id INTEGER,


temperature DOUBLE PRECISION


);


SELECT create_hypertable('sensor_data', 'time');




SELECT time_bucket('5m', time) AS bucket,


AVG(temperature) FROM sensor_data


WHERE time > NOW() - INTERVAL '24h'


GROUP BY bucket;





Performance

For 1 billion rows, QuestDB and InfluxDB lead on write throughput. TimescaleDB wins on SQL compatibility. Choose based on your query patterns and ecosystem requirements.

Conclusion

Choose InfluxDB for purpose-built time-series, TimescaleDB for SQL compatibility, and QuestDB for maximum performance. All support downsampling and retention policies.