Skip to content

Commit 9e4f558

Browse files
committed
[miq_provision_virt_workflow.rb] Specify vm cols
This reduces the number of columns returned from the VMs table to reduce what is returned and serialized from the DB. Benchmark --------- **Before** | ms | queries | query (ms) | rows | | ---: | ---: | ---: | ---: | | 39488 | 33 | 2439.4 | 243133 | | 38879 | 33 | 2438.2 | 243133 | | 39256 | 33 | 2444.3 | 243133 | **After** | ms | queries | query (ms) | rows | | ---: | ---: | ---: | ---: | | 28440 | 33 | 1929.5 | 243133 | | 28491 | 33 | 1933.6 | 243133 | | 28858 | 33 | 2631.9 | 243133 |
1 parent 05818e6 commit 9e4f558

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/models/miq_provision_virt_workflow.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ def allowed_templates(options = {})
337337
end
338338
end
339339

340+
# Only select the colums we need
341+
vms = vms.select(:id, :name, :guid, :uid_ems, :ems_id)
342+
340343
allowed_templates_list = source_vm_rbac_filter(vms, condition, VM_OR_TEMPLATE_EXTRA_COLS).to_a
341344
@allowed_templates_filter = filter_id
342345
@allowed_templates_tag_filters = @values[:vm_tags]

0 commit comments

Comments
 (0)