Uploaded image for project: 'mod-audit'
  1. mod-audit
  2. MODAUD-69

mod_audit.circulation_logs query utilizing excessive DB CPU

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • P2
    • Resolution: Done
    • None
    • 2.3.0
    • Firebird Sprint 133
    • 1
    • Firebird
    • Kiwi (R3 2021) Hot Fix #2
    • Yes
    • Approved in Slack (2-7-2022)
    • Cornell
    • Data related (ex. Can be detected with large dataset only)

    Description

      We are experiencing AWS RDS excessive CPU alarms on iris - mod-audit-2.0.1

      Attached is screenshot from Performance Insights.

      mod_audit.circulation_logs table has 282527 records.

      The RDS logs had many of the following queries with durations ranging from 5000-15,000 ms

      2021-04-07 20:03:02 UTC:10.23.36.149(60020):fs09000000_mod_audit@folio:[32259]:LOG: duration: 7228.793 ms statement: EXPLAIN ANALYZE SELECT * FROM fs09000000_mod_audit.circulation_logs WHERE ((CASE WHEN length(lower(f_unaccent('2021-02-01T00:00:00.000'))) <= 600 THEN left(lower(f_unaccent(circulation_logs.jsonb->>'date')),600) >= lower(f_unaccent('2021-02-01T00:00:00.000')) ELSE left(lower(f_unaccent(circulation_logs.jsonb->>'date')),600) >= left(lower(f_unaccent('2021-02-01T00:00:00.000')),600) AND lower(f_unaccent(circulation_logs.jsonb->>'date')) >= lower(f_unaccent('2021-02-01T00:00:00.000')) END) AND (CASE WHEN length(lower(f_unaccent('2021-04-07T23:59:59.999'))) <= 600 THEN left(lower(f_unaccent(circulation_logs.jsonb->>'date')),600) <= lower(f_unaccent('2021-04-07T23:59:59.999')) ELSE left(lower(f_unaccent(circulation_logs.jsonb->>'date')),600) <= left(lower(f_unaccent('2021-04-07T23:59:59.999')),600) AND lower(f_unaccent(circulation_logs.jsonb->>'date')) <= lower(f_unaccent('2021-04-07T23:59:59.999')) END)) AND (CASE WHEN length(lower(f_unaccent('Checked out'))) <= 600 THEN left(lower(f_unaccent(circulation_logs.jsonb->>'action')),600) LIKE lower(f_unaccent('Checked out')) ELSE left(lower(f_unaccent(circulation_logs.jsonb->>'action')),600) LIKE left(lower(f_unaccent('Checked out')),600) AND lower(f_unaccent(circulation_logs.jsonb->>'action')) LIKE lower(f_unaccent('Checked out')) END) ORDER BY left(lower(f_unaccent(circulation_logs.jsonb->>'date')),600) DESC, lower(f_unaccent(circulation_logs.jsonb->>'date')) DESC LIMIT 100 OFFSET 6500

       

      Test cases:

      Change (system) testing

      not UI related, will be verified by BE dev

      2) Regression testing:
      1. https://foliotest.testrail.io/index.php?/cases/view/16997
      2. https://foliotest.testrail.io/index.php?/cases/view/16981 
      3. https://foliotest.testrail.io/index.php?/cases/view/16978

      4. https://foliotest.testrail.io/index.php?/cases/view/16980 

       

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                khandramai Viachaslau Khandramai
                brichardEbsco Bill Richard
                Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases