Ad Widget

Collapse

Many queries on creating/updating new IT Services

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xsbr
    Junior Member
    Zabbix Certified Specialist
    • Oct 2009
    • 25

    #1

    Many queries on creating/updating new IT Services

    Hi,

    I have a scenario with 4000 hosts and each host must be an IT Services too.

    When I add/update an IT Services, function add_service() (includes/services.inc.php) calls update_services_status_all().

    The problem is the update_services_status_all() executes 3 queries for each node (inside while()).

    If I have 4000 IT Services, to create a new IT Services, 12000 queries will be executed!!

    Code:
    DEBUG: SELECT s.status FROM services s,services_links l  WHERE l.serviceupid=1 AND s.serviceid=l.servicedownid  ORDER BY s.status  DESC 
    DEBUG: UPDATE services SET status = 0 WHERE serviceid=1
    DEBUG: SELECT servicealarmid, value  FROM service_alarms  WHERE serviceid=1 ORDER BY servicealarmid DESC LIMIT 1 OFFSET 0
    DEBUG: SELECT s.status FROM services s,services_links l  WHERE l.serviceupid=2 AND s.serviceid=l.servicedownid  ORDER BY s.status  DESC 
    DEBUG: UPDATE services SET status = 0 WHERE serviceid=2
    DEBUG: SELECT servicealarmid, value  FROM service_alarms  WHERE serviceid=2 ORDER BY servicealarmid DESC LIMIT 1 OFFSET 0
    ...
    DEBUG: SELECT s.status FROM services s,services_links l  WHERE l.serviceupid=2100 AND s.serviceid=l.servicedownid  ORDER BY s.status  DESC 
    DEBUG: UPDATE services SET status = 0 WHERE serviceid=2100
    DEBUG: SELECT servicealarmid, value  FROM service_alarms  WHERE serviceid=2100 ORDER BY servicealarmid DESC LIMIT 1 OFFSET 0
    Last edited by xsbr; 15-02-2011, 13:33.
Working...