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

long query in stage (2.4 seconds) GET /subscriptions/products/{product_id}

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

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

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

      Trace ID: 6b039d491221efa52d7c964a99e87567

      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_,
             subscripti1_.start_date          as start_da1_12_1_,
             subscripti1_.subscription_id     as subscrip2_12_1_,
             subscripti3_.product_id          as product_1_14_2_,
             subscripti3_.start_date          as start_da0_14_2_,
             subscripti3_.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_,
             subscripti1_.account_number      as account_3_12_1_,
             subscripti1_.billing_account_id  as billing_4_12_1_,
             subscripti1_.billing_provider    as billing_5_12_1_,
             subscripti1_.billing_provider_id as billing_6_12_1_,
             subscripti1_.end_date            as end_date7_12_1_,
             subscripti1_.has_unlimited_usage as has_unli8_12_1_,
             subscripti1_.org_id              as org_id9_12_1_,
             subscripti1_.quantity            as quantit10_12_1_,
             subscripti1_.sku                 as sku11_12_1_,
             subscripti1_.subscription_number as subscri12_12_1_,
             subscripti3_.start_date          as start_da2_14_2_,
             subscripti3_.subscription_id     as subscrip3_14_2_,
             subscripti3_.start_date          as start_da2_14_0__,
             subscripti3_.subscription_id     as subscrip3_14_0__,
             subscripti3_.product_id          as product_1_14_0__,
             subscripti3_.start_date          as start_da0_14_0__,
             subscripti3_.subscription_id     as subscrip0_14_0__
      from subscription_measurements subscripti0_
               inner join subscription subscripti1_ on subscripti0_.start_date = subscripti1_.start_date and
                                                       subscripti0_.subscription_id = subscripti1_.subscription_id
               inner join subscription_product_ids subscripti3_ on subscripti1_.start_date = subscripti3_.start_date and
                                                                   subscripti1_.subscription_id = subscripti3_.subscription_id
      where subscripti1_.start_date <= ?
        and subscripti1_.end_date >= ?
        and subscripti1_.org_id = ?
        and subscripti3_.product_id = ?
        and subscripti0_.metric_id = ? 

              karshah@redhat.com Kartik Shah
              bcourt@redhat.com Barnaby Court
              Trayvon McKnight Trayvon McKnight
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: