Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-5491

Improve performance of InListExpression.hashCode

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 5.0.0, 4.14.3
    • 4.15.0, 5.1.0
    • None
    • None

    Description

      WhereOptimizer runs very slow in parsing sql like "where A in (a1, a2, ..., a_N) and B = X" when N is very large. In our environment, it runs > 90s for N = 140000.

      This is because for the same instance of InListExpression, InListExpression.hashCode() is calculate every time, where InListExpression.values is traversed.

      In previous sql, InListExpression.hashCode() will be called N times, and InListExpression.values has N elements. Therefore the total complexity is N^2.

      Saving the hashCode of InListExpression can reduce the complexity to N. The test shows the large sql can be finished within 5 seconds.

      Attachments

        1. PHOENIX-5491-v2.patch
          8 kB
          Chen Feng
        2. PHOENIX-5491.patch
          8 kB
          Chen Feng

        Activity

          People

            fengchen8086 Chen Feng
            fengchen8086 Chen Feng
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: