Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4522

CPU cost of Sort should be lower if sort keys are empty

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.27.0
    • core

    Description

      The old method to compute the cost of sort has some problem.

      1. When the RelCollation is empty, there is no need to sort, but it still compute the cpu cost of sort.
      2. use n * log(n) * row_byte to estimate the cpu cost may be inaccurate, where n means the output row count of the sort operator, and row_byte means the average bytes of one row .

      Instead, I give follow suggestion.

      1. the cpu cost is zero if the RelCollation is empty.
      2. let heap_size be min(offset + fetch, input_count), and use input_count * max(1, log(heap_size))* row_byte to compute the cpu cost.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              871 hqx
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 9h 50m
                  9h 50m