[ 
https://issues.apache.org/jira/browse/DERBY-2998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12527589
 ] 

Thomas Nielsen commented on DERBY-2998:
---------------------------------------

When I step through the code executing the aliased nested selects above there 
is (currently) no between the inner SELECT and the outer WHERE. This makes the 
inner ROW_NUMBER() to be computed for *all* rows in the table, and then the 
first N rows are selected in the WHERE clause. As previously stated there is no 
short-cut in the execution. Not a very effective idea if you have a 
million-and-one rows in the table and only want the first few.

It would be strange if all subqueries are executed like this in derby - so on 
with the investigation...

> Add support for ROW_NUMBER() window function
> --------------------------------------------
>
>                 Key: DERBY-2998
>                 URL: https://issues.apache.org/jira/browse/DERBY-2998
>             Project: Derby
>          Issue Type: Sub-task
>          Components: SQL
>            Reporter: Thomas Nielsen
>            Assignee: Thomas Nielsen
>            Priority: Minor
>         Attachments: row_number_prototype-2.diff, row_number_prototype-2.stat
>
>
> As part of implementing the overall OLAP Operations features of SQL 
> (DERBY-581), implement the ROW_NUMBER() window function.
> More information about this feature is available at 
> http://wiki.apache.org/db-derby/OLAPRowNumber

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to