Project

General

Profile

Actions

Bug #23270

closed

slow query when updating content facet applicability counts

Added by Justin Sherrill over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Hosts
Target version:
Difficulty:
Triaged:
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 1 (0 open1 closed)

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 charactersClosedEvgeni Golov04/17/2018Actions
Actions

Also available in: Atom PDF