db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Hlavatý <hla...@code.cz>
Subject Re: Support for SQL Limit?
Date Sun, 28 Nov 2004 16:03:08 GMT
Daniel John Debrunner wrote:
> Derby supports limiting the number of rows returned by a query through
> the standard JDBC java.sql.Statement.setMaxRows() method.

And does it affect the execution plan? Knowing the maximum number of records
would be extremely useful for query optimizer, which could select a much faster
plan using indexes which otherwise has higher "per record" cost over mass methods
like full table scan...

This was (is?) one of the major shortcomings in SapDB - it always
realized query for first few records starting with specific value in an (existing) index order
by full table scan and sort, thinking the index scan would cost much more.


View raw message