Skip to content

Commit

Permalink
default to using inline sql views for reports
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kbrock committed May 29, 2019
1 parent 4cdd856 commit e7f45e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/miq_report/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/models/miq_report/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit e7f45e9

Please sign in to comment.