Konstantin Orlov created IGNITE-25531:
-----------------------------------------

             Summary: Sql. Remove Limit if there is Sort with fetch
                 Key: IGNITE-25531
                 URL: https://issues.apache.org/jira/browse/IGNITE-25531
             Project: Ignite
          Issue Type: Improvement
          Components: sql ai3
            Reporter: Konstantin Orlov


Take a look at example below:
{code}
SELECT * 
  FROM (SELECT x AS c1, x::varchar AS c2 FROM system_range(1, 10))
 ORDER BY c1, c2
 FETCH FIRST 5 ROWS ONLY;
----
Limit
    fetch: 5
    est: (rows=5)
  Sort
      collation: [C1 ASC, C2 ASC]
      fetch: 5
      est: (rows=5)
    Project
        fieldNames: [C1, C2]
        projection: [X, CAST(X):VARCHAR CHARACTER SET "UTF-8" NOT NULL]
        est: (rows=100)
      TableFunctionScan
          fieldNames: [X]
          invocation: SYSTEM_RANGE(1, 10)
          est: (rows=100)
{code}

Looks like we could remove Limit node on top because Sort incorporates the same 
limit.



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

Reply via email to