Details

Improvement

Status: Closed

Minor

Resolution: Fixed

None
Description
The old method to compute the cost of sort has some problem.
 When the RelCollation is empty, there is no need to sort, but it still compute the cpu cost of sort.
 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.
 the cpu cost is zero if the RelCollation is empty.
 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
 is superceded by

CALCITE4557 Sort costing should account the number of sort keys: the more keys to compare, the more the cost
 Open

CALCITE4558 Sort CPU cost should not incur perfield copy cost for alignment with filter and project
 Open
 links to