zensqlmonitor / influxdb-zabbix

Gather data from Zabbix back-end and load to InfluxDB in near real-time for enhanced performance and easier usage with Grafana.
MIT License
71 stars 26 forks source link

performance issue when use mysql #10

Closed dimsua closed 7 years ago

dimsua commented 7 years ago

when we load data from mysql with default indexes like KEYhistory_uint_1(itemid,clock) Performance was very poor, for example from table history_uint (300GB table-size) select for one month execute 3 days and i am interrupt them.

So its important to create indexes for clock column: create index clock_idx on history_uint(clock); create index clock_idx on history(clock); create index clock_idx on trends(clock); create index clock_idx on trends_uint(clock);

For trends* table we can use pt-online-schema-change for online index create without lock, but for history* table we can only use create index, because primary keys for this table doesnt exist (pt-online-schema-change can alter table when exist primary key)

zensqlmonitor commented 7 years ago

Thanks, I will add the indexes creation in the doc.