Skip to content

Commit 2405936

Browse files
yhabteablippserd
andcommitted
INNER JOIN states in the host and service list
Otherwise, MySQL will not use indexes on the state tables when filtering / sorting the views by columns from the state tables. Co-authored-by: Eric Lippmann <eric.lippmann@icinga.com>
1 parent a18c300 commit 2405936

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

application/controllers/HostsController.php

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function indexAction()
3838
$db = $this->getDb();
3939

4040
$hosts = Host::on($db)->with(['state', 'icon_image', 'state.last_comment']);
41+
$hosts->getWith()['host.state']->setJoinType('INNER');
4142
$hosts->setResultSetClass(VolatileStateResults::class);
4243

4344
$this->handleSearchRequest($hosts);

application/controllers/ServicesController.php

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function indexAction()
4747
'host.state',
4848
'icon_image'
4949
]);
50+
$services->getWith()['service.state']->setJoinType('INNER');
5051
$services->setResultSetClass(VolatileStateResults::class);
5152

5253
$this->handleSearchRequest($services);

0 commit comments

Comments
 (0)