SortableCustomField executes too many db queries

XMLWordPrintable

      Description

      There's a fallback implementation of ordering issues by custom field which can't be sorted using Lucene.

      This will cause n! executions of CustomField.getValue() which causes n! db queries for custom fields which are not loaded using EagerLoadingOfBizCustomFieldPersister (EagerLoadingOfBizCustomFieldPersister has some extra caching for CFs which store their values in customfieldvalues table)

      Reproduction scenario

      1. Create custom field which is not stored in customfieldvalue table.
        (I was using lexorank CF with disabled indexing)
      2. Create 25 issues
      3. Execute jql "ORDER BY <your custom field>"
      4. Measure, how many times ImmutableCustomField#getValue was called
        ER: 25 (one getValue() for each issue)
        AR: 125 (much more getValue() than needed)

      Proposed solution

      Reuse caching of custom field values inside IssueImpl and DocumentIssue

            Assignee:
            Ilya Zinoviev (Inactive)
            Reporter:
            Ilya Zinoviev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: