You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "hqx (Jira)" <ji...@apache.org> on 2021/03/06 03:59:00 UTC

[jira] [Comment Edited] (CALCITE-4522) Sort operator returns the same cpu cost no matter the RelCollation is empty or not

    [ https://issues.apache.org/jira/browse/CALCITE-4522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17296425#comment-17296425 ] 

hqx edited comment on CALCITE-4522 at 3/6/21, 3:58 AM:
-------------------------------------------------------

Thanks, I modify the issue description more detailed. I suggest the follow formula because we can use heap sort if offset + fetch < input_count, else use heap sort, quick sort and so on.

sort_cpu_cost  = min(offset + fetch, input_count) * log(input_count)* row_byte

 


was (Author: 871):
Thanks, I modify the issue description more detailed. I suggest the follow formula because we can use heap sort if offset + fetch < input_count, else use heap sort, quick sort and so on.

     min(offset + fetch, input_count) * log(input_count)* row_byte

 

> Sort operator returns the same cpu cost no matter the RelCollation is empty or not
> ----------------------------------------------------------------------------------
>
>                 Key: CALCITE-4522
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4522
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: hqx
>            Priority: Minor
>
> 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.
>  # use min(offset + fetch, input_count) * log\(input_count)* row_byte to compute the cpu cost.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)