Bug 1650259 - slow errata query on dashboard
Summary: slow errata query on dashboard
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Errata Management
Version: 6.3.2
Hardware: Unspecified
OS: Unspecified
unspecified
high vote
Target Milestone: 6.5.0
Assignee: Partha Aji
QA Contact: Perry Gagne
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-15 17:00 UTC by sthirugn@redhat.com
Modified: 2019-11-05 22:38 UTC (History)
4 users (show)

Fixed In Version: tfm-rubygem-katello-3.10.0.13-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1684702 (view as bug list)
Environment:
Last Closed: 2019-05-14 12:38:50 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:38:58 UTC
Foreman Issue Tracker 25884 None None None 2019-01-17 20:35:20 UTC

Description sthirugn@redhat.com 2018-11-15 17:00:50 UTC
Description of problem:
slow errata query on dashboard

Version-Release number of selected component (if applicable):
Satellite 6.3.2.1

How reproducible:
Always

Steps to Reproduce:
The errata query running while loading the `Latest Errata` widget is slow and it takes a minute or so to complete in an environment with tens of thousands of content hosts.

Actual results:
From a customer postgres log:
2018-11-13 15:48:49 CET LOG:  duration: 57899.066 ms  execute <unnamed>: SELECT  "katello_errata".* FROM "katello_errata" WHERE "katello_errata"."id" IN (SELECT "katello_errata"."id" FROM "katello_errata" INNER JOIN "katello_content_facet_errata" ON "katello_content_facet_errata"."erratum_id" = "katello_errata"."id" INNER JOIN "katello_content_facets" ON "katello_content_facets"."id" = "katello_content_facet_errata"."content_facet_id" WHERE "katello_content_facets"."host_id" IN (62722, 62491, 62714, 55649, 76365, 71628, 47225, 60610, 65394, 65702, 76176, 76414, 62661, 76168, 69493, 5852, 75420, 56275, 69760, 5851, 5951, 62715, 71077, 1900, 1898, 69768, 68857, 62809, 68860, 65819, 7941, 46094, 68799, 296, 3918, 7920, 68859, 53753, 17840, 69645, 71079, 20953, 49090, 64997, 53764, 21250, 69437, 71047, 46977, 3, 65822, 65821, 47224, 65820, 298, 65703, 69657, 68858, 10046, 5636, 76170, 16608, 45148, 5631, 22449, 65823, 2866, 2274, 5630, 5628, 3427, 5560, 18091, 47064, 5612, 6988, 6760, 69769, 69354, 48893, 39879, 46986, 7115, 5627, 34668, 15825, 17334, 20733, 52097, 54362, 65563, 65399, 45808, 49326, 299, 49325, 62483, 1902, 71078, 50379, 34996, 71076, 40335, 69762, 73328, 76220, 69432, 1905, 46083, 73801, 64679, 47065, 69761, 62670, 44980, 45149, 72054, 66401, 19193, 1904, 60612, 44373, 62669, 62664, 69346, 482, 46082, 72483, 45529, 62671, 63140, 48894, 38722, 53496, 45706, 72639, 45653, 62668, 66661, 41251, 41482, 65558, 34321, 34322, 163, 57429, 67659, 39796, 72405, 72329, 34995, 4966, 44471, 42644, 66615, 72365, 52555, 58735, 62437, 57940, 69774, 45866, 41483, 71254, 280, 71482, 72494, 69348, 43954, 25170, 72607, 73764, 1895, 56330, 67382, 57156, 46095, 57155, 71606, 18650, 45840, 63979, 45865, 71452, 66390, 64047, 25174, 57197, 57428, 69347, 66766, 20434, 75419, 56619, 62654, 72627, 69072, 60122, 60633, 62485, 34665, 62488, 45810, 62720, 64682, 74941, 66758, 58631, 69773, 56190, 43256, 25173, 45523, 45248, 57112, 39836, 62487, 62718, 45235, 1864, 45237, 57304, 62666, 45239, 57941, 57430, 48763, 62482, 25172, 22793, 57244, 57221, 46331, 45124, 45123, 53255, 25171, 53523, 22699, 45236, 52553, 62644, 49182, 48594, 56617, 56288, 32317, 56132, 43955, 1901, 62568, 53500, 45841, 50157, 56329, 56332, 966, 20433, 21225, 4002))  ORDER BY katello_errata.updated desc LIMIT 6

Expected results:
the query should be optimized to run faster.

Additional info:
A related bug https://bugzilla.redhat.com/show_bug.cgi?id=1553879 was fixed in 6.3.1 which removed the distinct clause from the query, but there is more scope for optimization.

Comment 1 sthirugn@redhat.com 2018-11-15 17:07:01 UTC
This query takes anywhere between 30 seconds to 90 seconds in this customer environment.

Comment 4 Marek Hulan 2018-12-19 15:26:09 UTC
Might be related to https://bugzilla.redhat.com/show_bug.cgi?id=1656470#c3

Comment 5 Partha Aji 2019-01-17 20:35:19 UTC
Connecting redmine issue https://projects.theforeman.org/issues/25884 from this bug

Comment 6 Bryan Kearney 2019-01-17 23:04:41 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25884 has been resolved.

Comment 8 Perry Gagne 2019-02-04 16:42:37 UTC
Verified fix in 6.5 snap 13. 

Used content-host-d to generate a number of hosts and the query time when down a lot:

From postgres logs, times for " execute <unnamed>: SELECT  "katello_errata".* FROM "katello_errata" "

8K Hosts: 2019-01-31 11:26:10 EST LOG:  duration: 1373.899 ms
12K hosts : 2019-02-04 10:11:04 EST LOG:  duration: 2088.931 ms  execute <unnamed>: SELECT  "katello_errata".* FROM "katello_errata"

The dashboard widget loaded almost instantly as a result.

Comment 9 Mike McCune 2019-03-01 22:16:34 UTC
This bug was cloned and is still going to be included in the 6.4.3 release. It no longer has the sat-6.4.z+ flag and 6.4.3 Target Milestone Set which are now on the 6.4.z cloned bug. Please see the Clones field to track the progress of this bug in the 6.4.3 release.

Comment 12 errata-xmlrpc 2019-05-14 12:38:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222


Note You need to log in before you can comment on or make changes to this bug.