Skip to content

Commit

Permalink
[miq_provision_virt_workflow.rb] Specify vm cols
Browse files Browse the repository at this point in the history
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 |
  • Loading branch information
NickLaMuro committed Aug 19, 2019
1 parent c8cc799 commit 69c94ad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/models/miq_provision_virt_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 69c94ad

Please sign in to comment.