We use cookies for site analytics, to measure our advertising campaigns and, if you allow it, to load the site search from Google. Nothing optional is set until you choose. You can change your choice anytime in Your Privacy Choices at the bottom of every page. Cookie Policy
ThingsBoard Edge uses PostgreSQL as its primary database — for entities, attributes, relations, alarms, events, and the cloud event queue. For time-series data, Edge also supports Cassandra as an alternative storage backend, using the same DATABASE_TS_TYPE variable as the ThingsBoard server.
Edge batches writes to maximize PostgreSQL throughput. Instead of inserting one row at a time, it collects data points into batches and flushes them periodically.
PostgreSQL time-series tables are partitioned by time to keep queries fast and enable efficient data expiration. Set the partition granularity with SQL_POSTGRES_TS_KV_PARTITIONING:
Value
Partition size
Best for
DAYS
1 day
High write volume — more partitions, faster drops
MONTHS
1 month (default)
Most deployments
YEARS
1 year
Very low write volume
INDEFINITE
No partitioning
Not recommended for production
Event tables (audit logs, rule engine debug events) also use time-based partitioning: