Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-2935

Address high database CPU caused by identified queries

XMLWordPrintable

    • 5
    • False
    • Hide

      None

      Show
      None
    • True

      Top Queries by CPU:

      Query 1:

       

      select distinct h1_0.id,h1_0.billing_account_id,h1_0.billing_provider,h1_0.cloud_provider,h1_0.display_name,h1_0.is_guest,h1_0.hardware_type,h1_0.hypervisor_uuid,h1_0.insights_id,h1_0.instance_id,h1_0.instance_type,h1_0.inventory_id,h1_0.is_hypervisor,h1_0.is_unmapped_guest,h1_0.last_applied_event_record_date,h1_0.last_seen,h1_0.num_of_guests,h1_0.org_id,h1_0.subscription_manager_id from hosts h1_0 where h1_0.org_id=$1 and h1_0.hypervisor_uuid in (select h2_0.subscription_manager_id from hosts h2_0 where h2_0.instance_id=$2) offset $3 rows fetch first $4 rows only 

      Appears to be called from export and is defined HERE

      The org_id can be added to the query to make sure of the existing index (org_id, instance_id). We should take a look to see if we can remove the sub query all together.

       

      Query 2:

      select count(distinct h1_0.id) from hosts h1_0 where h1_0.org_id=$1 and h1_0.hypervisor_uuid in (select h2_0.subscription_manager_id from hosts h2_0 where h2_0.instance_id=$2) 

      Could be due to iterating the Paged result above. If this is the case, improving the query above should improve this as well.

              mstead@redhat.com Michael Stead
              mstead@redhat.com Michael Stead
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: