downsample: enabled: true rules: - from: raw to: 5m agg: [avg, max, min, count] Measurement (like SQL table) ├── Timestamp (always present, nanosecond precision) ├── Tags (indexed, low-cardinality) → e.g., device_id, region └── Fields (numeric, high-cardinality, compressed) → e.g., temperature, voltage Example write (Influx-like line protocol):
tdb2_ingest_points_total tdb2_query_duration_secondsquantile="0.99" tdb2_partitions_active tdb2_compaction_queue_length tdb2_disk_usage_bytesdata" tdb v2
curl http://localhost:8086/health # "status":"ok","version":"2.0.1" | Problem | Cause | Fix | |---------|-------|-----| | Memory explosion | Too many unique series | Reduce tag cardinality; enable series limit | | Slow queries over 7d+ | Missing downsampling | Create aggregate retention policy | | High disk usage | Compression disabled | Enable zstd or lz4 | | Data gaps | Out-of-order beyond window | Increase out_of_order_window | | Write timeouts | Small batch size | Batch writes; increase timeout to 10s | 11. Sample Use Case: IoT Fleet Monitoring Requirements: 50k vehicles × 20 metrics every 30 seconds → 1.2B points/day. Keep raw 7 days, hourly averages 1 year. downsample: enabled: true rules: - from: raw to:
Note: If you are referring to a specific proprietary system (e.g., a company’s internal TDB, a renamed tool like TDengine, or a module in Apache Jena), this guide covers general principles of modern TDB V2 architecture. Adjust based on your actual stack. 1. What is TDB V2? TDB V2 represents the second generation of time-series databases designed for ingestion velocity , compression efficiency , and analytical speed on time-stamped data. Note: If you are referring to a specific
-- Retention CREATE RETENTION POLICY raw ON fleet DURATION 7d REPLICATION 1; CREATE RETENTION POLICY hour ON fleet DURATION 365d; -- Downsample automatically CREATE CONTINUOUS QUERY auto_downsample ON fleet BEGIN SELECT mean(temp) AS temp_avg, max(temp) AS temp_max INTO fleet.hour.:measurement FROM fleet.raw.:measurement GROUP BY time(1h), * END;