Commit f567b12
committed
Update Vm#find_all_by_mac_address_and_hostname_and_ipaddress
Instead of going to Hardware and mapping to Vm, just go to Vm.
Instead of bringing back a bunch of Nics (guest_devices) and Networks, just us `joins`.
Performance characteristics:
- `Vm` (vs `VmOrTemplate`) tacked on a bunch of `type` values in the `WHERE` clause.
- The `SELECT` only brings back `vms.*` rather than `hardwares.*`, `vms.*`, and at least one more: `devices.*` or `networks.*`.
It is still performing 1 query, but 2 fewer extra tables.
This is now a `scope` rather than an `Array`.1 parent 05d5f4a commit f567b12
1 file changed
+8
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
223 | 206 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 207 | + | |
228 | 208 | | |
229 | 209 | | |
230 | 210 | | |
| |||
0 commit comments