Support of a time-series database has been added since Zabbix 4.2 in the form of experimental support of TimescaleDB, a PostgreSQL-based database solution of automatically partitioning data into time-based chunks to support faster performance at scale.
This section provides the steps necessary for migrating from existing PostgreSQL tables to TimescaleDB.
We assume that TimescaleDB extension has been already installed on the database server (see installation instructions).
TimescaleDB extension must also be enabled for the specific DB by executing:
echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u postgres psql zabbix
Running this command requires database administrator privileges.
echo "CREATE EXTENSION IF NOT EXISTS timescaledb SCHEMA yourschema CASCADE;" | sudo -u postgres psql zabbix
Then run the
timescaledb.sql script located in database/postgresql:
cat timescaledb.sql | sudo -u zabbix psql zabbix
Migration of existing history and trend data may take a lot of time. Zabbix server and frontend must be down for the period of migration.
timescaledb.sql script sets the following housekeeping parameters (from Administration → General → Housekeeping):
In order to use partitioned housekeeping for history and trends both these options must be on. It's possible to use TimescaleDB partitioning only for trends (by setting Override item trend period) or only for history (Override item history period).