Improve the efficiency of some queries (#13974)

* Improve the efficiency of some queries
Mostly by switching from whereIn to whereIntegerInRaw.
This inserts integers directly into the query instead of using placeholders (also escapes them)

also remove extra json_encode/json_decode in PingCheck

* Fix return types

Probably will result in some missing baseline exceptions.

* Update PingCheck.php

* whitespace
This commit is contained in:
Tony Murray
2022-05-16 02:57:58 -05:00
committed by GitHub
parent a7147a17e1
commit 5076deccf3
14 changed files with 31 additions and 29 deletions

View File

@@ -210,7 +210,7 @@ class Device extends BaseModel
if ($this->groups->isNotEmpty()) {
$query->orWhereHas('deviceGroups', function (Builder $query) {
$query->whereIn('alert_schedulables.alert_schedulable_id', $this->groups->pluck('id'));
$query->whereIntegerInRaw('alert_schedulables.alert_schedulable_id', $this->groups->pluck('id'));
});
}