Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FINE] Faster report result index pages #4208

Merged
merged 3 commits into from
Jun 26, 2018

Commits on Jun 25, 2018

  1. [FINE] Prefer valid_report_column? and contains_records? from MiqRepo…

    …rtResult
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1594387
    
    Gaprindashvili Backport commit from:
    
        ManageIQ#4143
    
    Original SHA:
    
       ff7ee24
    
    Rest of original message below...
    
    * * *
    
    These are new methods added in:
    
    ManageIQ/manageiq#17590
    
    And are far more efficient for the use cases of ChargebackController and
    ReportController::SavedReports.
    NickLaMuro committed Jun 25, 2018
    Configuration menu
    Copy the full SHA
    64f8b1f View commit details
    Browse the repository at this point in the history
  2. [FINE] Prefer .exists? over .length? in report button helpers

    https://bugzilla.redhat.com/show_bug.cgi?id=1594387
    
    Gaprindashvili Backport commit from:
    
        ManageIQ#4143
    
    Original SHA:
    
       cb118f0
    
    Rest of original message below...
    
    * * *
    
    Calls to `.length` will fetch the entire record set or rows for the
    MiqReportResult, and in the current case of these button helpers, throw
    them all away without using any of the data fetched.  In most cases, the
    `html_details` relation is probably what was is being used, so even
    caching these ahead of time is wasteful.
    
    By using `.exists?` as an alternative, we basically do a:
    
      SELECT 1 as one
      FROM miq_report_result_details
      WHERE "miq_report_result_details"."miq_report_result_id" = ?
      LIMIT 1
    
    Which only returns a single digit from the database if it has at least
    one record and nothing if it doesn't.  This will also be cached in a
    controller action by the ActiveRecord query cache, so it will also
    require zero queries the second time around.
    NickLaMuro committed Jun 25, 2018
    Configuration menu
    Copy the full SHA
    adba577 View commit details
    Browse the repository at this point in the history
  3. [FINE] Prefer rr.report over rr.report_results in SavedReportPagi…

    …ng mixin
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1594387
    
    Gaprindashvili Backport commit from:
    
        ManageIQ#4143
    
    Original SHA:
    
       b5260fd
    
    Rest of original message below...
    
    * * *
    
    This not only makes it so we are consistent between the main controller
    and the mixin, but this is also much faster to use this over
    `MiqReportResult#report_results` when there is a large `binary_blob`
    associated with the `MiqReportResult` record.
    NickLaMuro committed Jun 25, 2018
    Configuration menu
    Copy the full SHA
    02fd904 View commit details
    Browse the repository at this point in the history