Uploaded image for project: 'ODE'
  1. ODE
  2. ODE-641

Hibernate DAO delete instances queries optimization

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.2
    • 1.3.4, 2.0-beta3
    • BPEL Runtime
    • None

    Description

      I saw that queries like:
      select id from HMessage as m WHERE m.messageExchange IN(select e from HMessageExchange e where e.instance in (:instances))
      are poorly optimized by MySQL.
      Changing them to:
      select m.id from HMessage m, HMessageExchange mex WHERE m.messageExchange = mex and mex.instance in (:instances)
      makes them faster by order of magnitude.
      I used indexes from attachment.

      Oracle seems to handle them well, however it has problems with "or" queries like this:
      "SELECT_MEX_LDATA_IDS_BY_INSTANCES" query="select id from HLargeData as d where d in(select e.endpoint from HMessageExchange as e where e.instance in (:instances)) or d IN(select e.
      callbackEndpoint from HMessageExchange as e where e.instance in (:instances))"

      So I divided "or" queries into 2 separate queries.

      I prepared a patch, which I tested on standalone cleanup application (using ProcessDaoImpl.deleteInstances(a single instance) ) and I got a following speedup on 3500 instances:
      mysql:
      without patch 2000 ms
      patched 40 ms

      oracle:
      without patch 2000 ms
      patched 75 ms

      Attachments

        1. ode1x_indexes.sql
          2 kB
          Rafal Rusin

        Issue Links

          Activity

            People

              rrusin Rafal Rusin
              rrusin Rafal Rusin
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: