From e7f45e93fda135e3cda7d55f867653cc6244a1e1 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Wed, 29 May 2019 18:08:08 -0400 Subject: [PATCH] default to using inline sql views for reports for reports and the report data (right hand of screen) allow the use of inline sql views (aka the "turbo button") when there are virtual attributes in the primary query, they get run for every row (even those not brought back) this option allows rbac to optimize the query in these cases to run the virtual attributes in an outer query, so they only get run for the few rows brought back --- app/models/miq_report/generator.rb | 2 +- app/models/miq_report/search.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/miq_report/generator.rb b/app/models/miq_report/generator.rb index 42c8a5742e59..06c16ed766e8 100644 --- a/app/models/miq_report/generator.rb +++ b/app/models/miq_report/generator.rb @@ -319,7 +319,7 @@ def generate_basic_results(options = {}) ## add in virtual attributes that can be calculated from sql rbac_opts[:extra_cols] = va_sql_cols unless va_sql_cols.blank? - rbac_opts[:use_sql_view] = true if db_options && db_options[:use_sql_view] + rbac_opts[:use_sql_view] = true unless db_options && db_options[:use_sql_view] == false results, attrs = Rbac.search(rbac_opts) results = Metric::Helper.remove_duplicate_timestamps(results) diff --git a/app/models/miq_report/search.rb b/app/models/miq_report/search.rb index 2e8729d3d4e5..b7348e6c9481 100644 --- a/app/models/miq_report/search.rb +++ b/app/models/miq_report/search.rb @@ -97,7 +97,7 @@ def paged_view_search(options = {}) ) search_options.merge!(:limit => limit, :offset => offset, :order => order) if order search_options[:extra_cols] = va_sql_cols if va_sql_cols.present? - search_options[:use_sql_view] = true if db_options && db_options[:use_sql_view] + search_options[:use_sql_view] = true unless db_options && db_options[:use_sql_view] == false if options[:parent] targets = get_parent_targets(options[:parent], options[:association] || options[:parent_method])