From 69c94ad4de9d57d163efc7ffed71ca5a3e9b39f7 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Wed, 9 Jan 2019 17:04:55 -0600 Subject: [PATCH] [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 | --- app/models/miq_provision_virt_workflow.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/miq_provision_virt_workflow.rb b/app/models/miq_provision_virt_workflow.rb index 9bf2ab5a3cb..a567725cf8b 100644 --- a/app/models/miq_provision_virt_workflow.rb +++ b/app/models/miq_provision_virt_workflow.rb @@ -339,6 +339,9 @@ def allowed_templates(options = {}) end end + # Only select the colums we need + vms = vms.select(:id, :name, :guid, :uid_ems, :ems_id) + allowed_templates_list = source_vm_rbac_filter(vms, condition, VM_OR_TEMPLATE_EXTRA_COLS).to_a @allowed_templates_filter = filter_id @allowed_templates_tag_filters = @values[:vm_tags]