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

long query (26 Seconds) in stage /capacity/products/{product_id}/{metric_id}

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      When running a request for GET /api/rhsm-subscriptions/v1/capacity/products/{product_id}/{metric_id}

      Full Query: /api/rhsm-subscriptions/v1/capacity/products/RHEL/Sockets?sla=Premium&granularity=Daily&beginning=2023-06-14T06%3A30%3A52.773475%2B00%3A00&ending=2023-06-15T08%3A26%3A53.253803%2B00%3A00

      we are sometimes seeing very long query times in stage. Specifically the following query is taking more than 26 seconds. 

      Trace ID: 3e05bd3a01daaaa2a424f895913a29c1

      Calling Method: SubscriptionMeasurementRepository.findAll(...)

      SQL Query: 

      select subscripti0_.measurement_type    as measurem1_13_0_,
             subscripti0_.metric_id           as metric_i2_13_0_,
             subscripti0_.start_date          as start_da0_13_0_,
             subscripti0_.subscription_id     as subscrip0_13_0_,
             subscripti2_.start_date          as start_da1_12_1_,
             subscripti2_.subscription_id     as subscrip2_12_1_,
             subscripti4_.product_id          as product_1_14_2_,
             subscripti4_.start_date          as start_da0_14_2_,
             subscripti4_.subscription_id     as subscrip0_14_2_,
             subscripti0_.start_date          as start_da4_13_0_,
             subscripti0_.subscription_id     as subscrip5_13_0_,
             subscripti0_.value               as value3_13_0_,
             subscripti2_.account_number      as account_3_12_1_,
             subscripti2_.billing_account_id  as billing_4_12_1_,
             subscripti2_.billing_provider    as billing_5_12_1_,
             subscripti2_.billing_provider_id as billing_6_12_1_,
             subscripti2_.end_date            as end_date7_12_1_,
             subscripti2_.has_unlimited_usage as has_unli8_12_1_,
             subscripti2_.org_id              as org_id9_12_1_,
             subscripti2_.quantity            as quantit10_12_1_,
             subscripti2_.sku                 as sku11_12_1_,
             subscripti2_.subscription_number as subscri12_12_1_,
             subscripti4_.start_date          as start_da2_14_2_,
             subscripti4_.subscription_id     as subscrip3_14_2_,
             subscripti4_.start_date          as start_da2_14_0__,
             subscripti4_.subscription_id     as subscrip3_14_0__,
             subscripti4_.product_id          as product_1_14_0__,
             subscripti4_.start_date          as start_da0_14_0__,
             subscripti4_.subscription_id     as subscrip0_14_0__
      from subscription_measurements subscripti0_
               cross join offering offering1_
               inner join subscription subscripti2_ on subscripti0_.start_date = subscripti2_.start_date and
                                                       subscripti0_.subscription_id = subscripti2_.subscription_id
               inner join subscription_product_ids subscripti4_ on subscripti2_.start_date = subscripti4_.start_date and
                                                                   subscripti2_.subscription_id = subscripti4_.subscription_id
      where subscripti2_.start_date <= ?
        and subscripti2_.end_date >= ?
        and subscripti2_.org_id = ?
        and subscripti4_.product_id = ?
        and subscripti2_.sku = offering1_.sku
        and offering1_.sla = ?
        and subscripti0_.metric_id = ?

              awood1@redhat.com Alex Wood
              bcourt@redhat.com Barnaby Court
              Trayvon McKnight Trayvon McKnight
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: