From 988bc2cf4441c608d5f88d1ba6e9900aed886e7a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 16 Jun 2015 08:09:54 +0200 Subject: [PATCH] ServicestatusQuery: Improve JOIN performance refs #9009 --- .../Backend/Ido/Query/ServicestatusQuery.php | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php index f336ce30d..1beae3917 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php @@ -212,14 +212,8 @@ class ServicestatusQuery extends IdoQuery array() )->join( array('s' => $this->prefix . 'services'), - 's.service_object_id = so.object_id', + 's.service_object_id = so.object_id AND so.is_active = 1 AND so.objecttype_id = 2', array() - )->where( - 'so.is_active = ?', - 1 - )->where( - 'so.objecttype_id = ?', - 2 ); $this->joinedVirtualTables['services'] = true; } @@ -239,14 +233,8 @@ class ServicestatusQuery extends IdoQuery array() )->join( array('hgo' => $this->prefix . 'objects'), - 'hgo.object_id = hg.hostgroup_object_id', + 'hgo.object_id = hg.hostgroup_object_id AND hgo.is_active = 1 AND hgo.objecttype_id = 3', array() - )->where( - 'hgo.is_active = ?', - 1 - )->where( - 'hgo.objecttype_id = ?', - 3 ); $this->group(array('so.name2', 'so.name1')); } @@ -290,15 +278,8 @@ class ServicestatusQuery extends IdoQuery array() )->join( array('sgo' => $this->prefix . 'objects'), - 'sgo.object_id = sg.servicegroup_object_id', + 'sgo.object_id = sg.servicegroup_object_id AND sgo.is_active = 1 AND sgo.objecttype_id = 4', array() - )->where( - 'sgo.is_active = ?', - 1 - ) - ->where( - 'sgo.objecttype_id = ?', - 4 ); $this->group(array('so.name2', 'so.name1')); }