Hi:
I have an issue getting a screen with a period of one year.
This screen has 30 graphs (with 2 items each), and it seems that the min,max,avg query locks the mysql server and causes that the queue grows too much during this.
Executing the sql queries by hand, getting the min,max,avg values for a graph (period of one year) takes about 30 seconds for the first graph, and then the time for each calculation grows to 50 seconds and more..
During all this time, zabbix_server seems to have problems inserting records (due to the locks, I guess).
I´m using 1.8.2, so, Is this issue resolved in any newer versions? How could this query be optimized?
array_push($sql_arr,
'SELECT itemid,'.$calc_field.' as i,'.
' sum(num) as count,avg(value_avg) as avg,min(value_min) as min,'.
' max(value_max) as max,max(clock) as clock'.
' FROM trends '.
' WHERE itemid='.$this->items[$i]['itemid'].
' AND clock>='.$from_time.
' AND clock<='.$to_time.
' GROUP BY itemid,'.$calc_field
,
'SELECT itemid,'.$calc_field.' as i,'.
' sum(num) as count,avg(value_avg) as avg,min(value_min) as min,'.
' max(value_max) as max,max(clock) as clock'.
' FROM trends_uint '.
' WHERE itemid='.$this->items[$i]['itemid'].
' AND clock>='.$from_time.
' AND clock<='.$to_time.
' GROUP BY itemid,'.$calc_field
);
I have an issue getting a screen with a period of one year.
This screen has 30 graphs (with 2 items each), and it seems that the min,max,avg query locks the mysql server and causes that the queue grows too much during this.
Executing the sql queries by hand, getting the min,max,avg values for a graph (period of one year) takes about 30 seconds for the first graph, and then the time for each calculation grows to 50 seconds and more..
During all this time, zabbix_server seems to have problems inserting records (due to the locks, I guess).
I´m using 1.8.2, so, Is this issue resolved in any newer versions? How could this query be optimized?
array_push($sql_arr,
'SELECT itemid,'.$calc_field.' as i,'.
' sum(num) as count,avg(value_avg) as avg,min(value_min) as min,'.
' max(value_max) as max,max(clock) as clock'.
' FROM trends '.
' WHERE itemid='.$this->items[$i]['itemid'].
' AND clock>='.$from_time.
' AND clock<='.$to_time.
' GROUP BY itemid,'.$calc_field
,
'SELECT itemid,'.$calc_field.' as i,'.
' sum(num) as count,avg(value_avg) as avg,min(value_min) as min,'.
' max(value_max) as max,max(clock) as clock'.
' FROM trends_uint '.
' WHERE itemid='.$this->items[$i]['itemid'].
' AND clock>='.$from_time.
' AND clock<='.$to_time.
' GROUP BY itemid,'.$calc_field
);
Comment