Project

General

Profile

Bug #23270

slow query when updating content facet applicability counts

Added by Justin Sherrill over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Hosts
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

When there are a lot of hosts and a lot of rpms, this query can be slow:

SELECT COUNT(*) FROM "katello_rpms" INNER JOIN "katello_content_facet_applicable_rpms" ON "katello_rpms"."id" = "katello_content_facet_appl
icable_rpms"."rpm_id" WHERE "katello_content_facet_applicable_rpms"."content_facet_id" = $1 [["content_facet_id", 51438]]

it is generated by:

      def update_applicability_counts
        self.update_attributes!(
            :installable_security_errata_count => self.installable_errata.security.count,
            :installable_bugfix_errata_count => self.installable_errata.bugfix.count,
            :installable_enhancement_errata_count => self.installable_errata.enhancement.count,
            :applicable_rpm_count => self.applicable_rpms.count,
            :upgradable_rpm_count => self.installable_rpms.count
        )
      end

Related issues

Related to Katello - Bug #23296: Index name 'index_katello_content_facet_applicable_rpms_on_content_facet_id' on table 'katello_content_facet_applicable_rpms' is too long; the limit is 62 charactersClosed2018-04-17

Associated revisions

Revision 9920678b (diff)
Added by Justin Sherrill over 3 years ago

Fixes #23270 - speed up applicability count update

History

#1 Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/7309 added

#2 Updated by Justin Sherrill over 3 years ago

  • Bugzilla link set to 1567978

#3 Updated by Justin Sherrill over 3 years ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#4 Updated by Justin Sherrill over 3 years ago

  • Related to Bug #23296: Index name 'index_katello_content_facet_applicable_rpms_on_content_facet_id' on table 'katello_content_facet_applicable_rpms' is too long; the limit is 62 characters added

#5 Updated by Justin Sherrill over 3 years ago

  • Legacy Backlogs Release (now unused) set to 338

Also available in: Atom PDF