You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "JingDas (Jira)" <ji...@apache.org> on 2023/08/04 05:04:00 UTC

[jira] [Created] (CALCITE-5894) Add SortRemoveRedundantRule to remove redundant sort fields if sort fields contains unique key

JingDas created CALCITE-5894:
--------------------------------

             Summary: Add SortRemoveRedundantRule to remove redundant sort fields if sort fields contains unique key
                 Key: CALCITE-5894
                 URL: https://issues.apache.org/jira/browse/CALCITE-5894
             Project: Calcite
          Issue Type: New Feature
            Reporter: JingDas
            Assignee: JingDas


In some scene, Sort fields can be reduct, if sort fields contain unique key

For Example
{code:java}
SELECT name, Emp.salary FROM Emp
order by empno, ename{code}
where `empno` is a key,  `ename` is redundant since `empno` alone is sufficient to determine the order of any two records.

So the SQL can be optimized as following:
{code:java}
SELECT name, Emp.salary FROM Emp
order by empno{code}
Sorting is an expensive operation, however. Therefore, it is imperative that sorting
is optimized to avoid unnecessary sort field.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)