From 8bf269c2b30ad065478faef218587d183a48964a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 16 Jun 2015 08:12:00 +0200 Subject: [PATCH] ServicegroupQuery: Improve JOIN performance refs #9009 --- .../Backend/Ido/Query/ServicegroupQuery.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicegroupQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicegroupQuery.php index 731a9994c..87cc12618 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicegroupQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicegroupQuery.php @@ -49,15 +49,8 @@ class ServicegroupQuery extends IdoQuery array() )->join( array('sgo' => $this->prefix . 'objects'), - 'sg.servicegroup_object_id = sgo.object_id', + 'sg.servicegroup_object_id = sgo.object_id AND sgo.is_active = 1 AND sgo.objecttype_id = 4', array() - )->where( - 'sgo.is_active = ?', - 1 - ) - ->where( - 'sgo.objecttype_id = ?', - 4 ); $this->joinedVirtualTables = array('servicegroups' => true); } @@ -78,15 +71,8 @@ class ServicegroupQuery 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 ); }